Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h

Issue 2516593003: Pull up clearCacheExceptFrame to ImageDecoder. (Closed)
Patch Set: Add todo for changing MockImageDecoder Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
index fde848af48feec88df6327db774f49fb8f0a0c52..8380ee4336613b4f4a05c853e7f336cd915bf414 100644
--- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
@@ -50,7 +50,6 @@ class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder {
int repetitionCount() const override;
bool frameIsCompleteAtIndex(size_t) const override;
float frameDurationAtIndex(size_t) const override;
- size_t clearCacheExceptFrame(size_t) override;
private:
// ImageDecoder:
@@ -63,6 +62,17 @@ class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder {
size_t dataSize,
size_t frameIndex);
+ // For WebP images, the frame status needs to be FrameComplete to decode
+ // subsequent frames that depend on frame |index|. The reason for this is that
+ // WebP uses the previous frame for alpha blending, in applyPostProcessing().
+ //
+ // Before calling this, verify that frame |index| exists by checking that
+ // |index| is smaller than |m_frameBufferCache|.size().
+ bool frameStatusSufficientForSuccessors(size_t index) override {
+ DCHECK(index < m_frameBufferCache.size());
+ return m_frameBufferCache[index].getStatus() == ImageFrame::FrameComplete;
+ }
+
WebPIDecoder* m_decoder;
WebPDecBuffer m_decoderBuffer;
int m_formatFlags;

Powered by Google App Engine
This is Rietveld 408576698