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

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: Enclose under runtime flag 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 ea74c8e117331796b92cdc7bd4dfc731a99ef571..2b92f14c7bd396793fb3befeb63523da3792c268 100644
--- a/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
+++ b/Source/core/platform/image-decoders/webp/WEBPImageDecoder.h
@@ -32,9 +32,13 @@
#include "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_ANIM_SUPPORT
Alpha Left Google 2013/04/25 22:07:12 Can you have this always defined such that animate
urvang (Google) 2013/04/26 01:46:23 It's basically to support different versions of li
+#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_ANIM_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_ANIM_SUPPORT
+ // Recreates demux object when new data is available, and sets canvas size, format flags,
+ // 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.
+ bool initFrameBuffer(const WebPIterator& fIter, size_t frameIndex);
+ // Apply color profile, and perform necessary post-processing for frame disposal.
+ void applyPostProcessing(size_t frameIndex);
+
+ // Number of rows decoded and post-processed so far in the current frame. It
+ // 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 clearAll();
+ void clearDecoder();
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698