Skip to content

Commit 83e5b96

Browse files
committed
[GTK][WPE] Stuttering when playing WebP animations
https://bugs.webkit.org/show_bug.cgi?id=297393 Reviewed by Carlos Garcia Campos. When clearing the FrameBuffer cache, keep the most recent complete frame around, because that will probably be necessary to decode the next frame. This avoids having to decode several frames in a row in order to get the next frame after a call to clearFrameBufferCache() is performed. * Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp: (WebCore::WEBPImageDecoder::clearFrameBufferCache): Canonical link: https://commits.webkit.org/298831@main
1 parent 67ef499 commit 83e5b96

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,13 @@ void WEBPImageDecoder::clearFrameBufferCache(size_t clearBeforeFrame)
351351
//
352352
// In WEBP every frame depends on the previous one or none. That means that frames after clearBeforeFrame
353353
// won't need any frame before them to render, so we can clear them all.
354+
bool skipNextComplete = true;
354355
for (int i = clearBeforeFrame - 1; i >= 0; i--) {
355356
auto& buffer = m_frameBufferCache[i];
357+
if (skipNextComplete && buffer.isComplete()) {
358+
skipNextComplete = false;
359+
continue;
360+
}
356361
if (!buffer.isInvalid())
357362
buffer.clear();
358363
}

0 commit comments

Comments
 (0)