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

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

Issue 2495183002: Pull up initFrameBuffer to ImageDecoder. (Closed)
Patch Set: Process feedback patch set 1 Created 4 years, 1 month 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/ImageDecoder.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
index d6169b58aeebc72104ed8a14f883ad644a14f644..448749834dc3de612cadf1e6d9245b192a01cd42 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -301,6 +301,12 @@ class PLATFORM_EXPORT ImageDecoder {
// returns that number.
virtual size_t decodeFrameCount() { return 1; }
+ // Called to initialize the frame buffer with the given index, based on the
+ // provided and previous frame's characteristics. Returns true on success. On
+ // failure, this will mark the image as failed. Before calling this method,
+ // the caller must verify that the frame exists.
+ bool initFrameBuffer(size_t);
+
// Performs any additional setup of the requested frame after it has been
// initially created, e.g. setting a duration or disposal method.
virtual void initializeNewFrame(size_t) {}
@@ -341,6 +347,14 @@ class PLATFORM_EXPORT ImageDecoder {
return total_size > ((1 << 29) - 1);
}
+ // This methods gets called at the end of initFrameBuffer. Subclasses can do
+ // format specific initialization, for e.g. alpha settings, here.
+ virtual void onInitFrameBuffer(size_t){};
+
+ // Called by initFrameBuffer to determine if it can take the bitmap of the
+ // previous frame. This condition is different for GIF and WEBP.
+ virtual bool canReusePreviousFrameBuffer(size_t) const { return false; }
scroggo_chromium 2016/11/14 16:44:12 I think this will only get called by WEBP, GIF, an
joostouwerling 2016/11/14 16:54:13 I picked false for the last reason you mentioned.
+
IntSize m_size;
bool m_sizeAvailable = false;
bool m_isAllDataReceived = false;

Powered by Google App Engine
This is Rietveld 408576698