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

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

Issue 13980003: Add animation support for WebP images (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments + correct assert Created 7 years, 8 months 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: Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
diff --git a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
index 6cb469c18012ff63a1e96afe673c3d2800fc6427..70355b652b983cad0b9c8df76e9b799f0d8e17b6 100644
--- a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
+++ b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
@@ -32,9 +32,13 @@
#include "core/platform/image-decoders/ImageDecoder.h"
#include "webp/decode.h"
-#if USE(QCMSLIB) && (WEBP_DECODER_ABI_VERSION > 0x200)
+#if (WEBP_DECODER_ABI_VERSION > 0x200)
+#include "webp/demux.h"
+#define WEBP_ICC_ANIMATION_SUPPORT
+#if USE(QCMSLIB)
#define QCMS_WEBP_COLOR_CORRECTION
#endif
+#endif
namespace WebCore {
@@ -45,29 +49,58 @@ public:
virtual String filenameExtension() const { return "webp"; }
virtual bool isSizeAvailable();
+ virtual size_t frameCount();
virtual ImageFrame* frameBufferAtIndex(size_t index);
+#ifdef WEBP_ICC_ANIMATION_SUPPORT
+ virtual void setData(SharedBuffer* data, bool allDataReceived);
+ virtual int repetitionCount() const { return m_repetitionCount; }
+ virtual void clearFrameBufferCache(size_t clearBeforeFrame);
+#endif
private:
- bool decode(bool onlySize);
+ bool decode(const uint8_t* dataBytes, size_t dataSize, bool onlySize, size_t frameIndex);
WebPIDecoder* m_decoder;
WebPDecBuffer m_decoderBuffer;
- bool m_hasAlpha;
int m_formatFlags;
#ifdef QCMS_WEBP_COLOR_CORRECTION
qcms_transform* colorTransform() const { return m_transform; }
void createColorTransform(const char* data, size_t);
- void readColorProfile(const uint8_t* data, size_t);
- void applyColorProfile(const uint8_t* data, size_t, ImageFrame&);
+ void readColorProfile();
bool m_haveReadProfile;
qcms_transform* m_transform;
+#endif
+
+#ifdef WEBP_ICC_ANIMATION_SUPPORT
+ // Recreates demux object when new data is available, and sets canvas size, format flags,
Noel Gordon 2013/05/03 18:15:46 You're trying to tell me again what I can read fro
urvang (Google) 2013/05/03 21:55:20 I like to err on the side of explicit commenting i
Noel Gordon 2013/05/04 17:23:43 Comments don't help if they contain factual errors
urvang (Google) 2013/05/07 06:53:44 I added notes about the major methods added in the
+ // animation properties etc as appropriate. Returns true on success. On
+ // failure, this will mark the image as failed.
+ bool updateDemuxer();
+ // Called to initialize the frame buffer at the given index based on
+ // the previous frame's disposal method. Returns true on success. On
+ // failure, this will mark the image as failed.
Noel Gordon 2013/05/03 18:15:46 s/this will mark/marks/
urvang (Google) 2013/05/03 21:55:20 Done.
+ bool initFrameBuffer(const WebPIterator&, size_t frameIndex);
+ // Apply color profile, and perform necessary post-processing for frame disposal.
Noel Gordon 2013/05/03 18:15:46 applyPostProcessing() tells me that some post proc
urvang (Google) 2013/05/03 21:55:20 Done.
+ void applyPostProcessing(size_t frameIndex);
+
+ // Number of rows decoded and post-processed so far in the current frame. It
Noel Gordon 2013/05/03 18:15:46 I'd accept the first sentence only. Move this dow
urvang (Google) 2013/05/03 21:55:20 Done.
Noel Gordon 2013/05/04 17:23:43 Apologies. I meant group the members of this #ifde
urvang (Google) 2013/05/07 06:53:44 Done.
+ // is used by applyPostProcessing() to decode and post-process incrementally.
int m_decodedHeight;
+
+ bool m_haveAlreadyParsedThisData;
+ WebPDemuxer* m_demux;
+ WebPDemuxState m_demuxState;
+
+ bool m_haveReadAnimParams;
+ int m_repetitionCount;
#else
- void applyColorProfile(const uint8_t*, size_t, ImageFrame&) { };
+ void applyPostProcessing(size_t) { };
#endif
+
void clear();
+ void clearDecoder();
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698