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

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

Issue 1460523002: GIF decoding to Index8, unit tests and misusing unit test as benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup. tableChanged was wrong - do proper check. Created 5 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 05388ef8f7154c63814a8deec632e04155820730..dfee0fe16c9172da9366fd348b80d7ab150b6702 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -168,7 +168,7 @@ public:
// Decodes as much of the requested frame as possible, and returns an
// ImageDecoder-owned pointer.
- ImageFrame* frameBufferAtIndex(size_t);
+ ImageFrame* frameBufferAtIndex(size_t, ImageFrame::ColorType = ImageFrame::N32);
scroggo_chromium 2015/12/03 21:47:21 It seems odd to me that the client asks for a part
aleksandar.stojiljkovic 2015/12/04 00:07:34 1st Reason is in discussion we had here: https://c
// Whether the requested frame has alpha.
virtual bool frameHasAlphaAtIndex(size_t) const;
@@ -292,6 +292,10 @@ public:
virtual bool canDecodeToYUV() { return false; }
virtual bool decodeToYUV() { return false; }
virtual void setImagePlanes(PassOwnPtr<ImagePlanes>) { }
+ virtual bool canDecodeTo(size_t index, ImageFrame::ColorType outputType)
+ {
+ return outputType == ImageFrame::N32;
+ }
protected:
// Calculates the most recent frame whose image data may be needed in
@@ -328,6 +332,15 @@ protected:
// Decodes the requested frame.
virtual void decode(size_t) = 0;
+ // Decodes the requested frame to specified color type output.
+ virtual void decodeTo(size_t index, ImageFrame::ColorType outputColor)
scroggo_chromium 2015/12/03 21:47:21 If we need to pass outputColor, why not merge this
aleksandar.stojiljkovic 2015/12/04 00:07:34 Didn't want to change code in other decoders, that
+ {
+ if (!canDecodeTo(index, outputColor))
scroggo_chromium 2015/12/03 21:47:21 So the subclass can override decodeTo and not call
aleksandar.stojiljkovic 2015/12/04 00:07:34 This would keep the existing decoders unchanged, j
+ return;
scroggo_chromium 2015/12/03 21:47:21 So this will silently fail?
aleksandar.stojiljkovic 2015/12/04 00:07:34 If there is no frame in cache, ImageFrameGenerator
+ // this is the default implementation that is just wrapping decode().
+ // subclasses need to override this and canDecodeTo for supported colorTypes.
+ decode(index);
+ }
RefPtr<SharedBuffer> m_data; // The encoded data.
Vector<ImageFrame, 1> m_frameBufferCache;

Powered by Google App Engine
This is Rietveld 408576698