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

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: const OVERRIDE Created 7 years, 6 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 5e7e2d8416b4ccc582eb6d92b6e58b99719d37f8..9c8e1a7b6e65a59a07dd9549c562a4c9af35c804 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 {
@@ -43,31 +47,53 @@ public:
WEBPImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
virtual ~WEBPImageDecoder();
- virtual String filenameExtension() const { return "webp"; }
- virtual bool isSizeAvailable();
- virtual ImageFrame* frameBufferAtIndex(size_t);
+ virtual String filenameExtension() const OVERRIDE { return "webp"; }
+ virtual bool isSizeAvailable() OVERRIDE;
+ virtual size_t frameCount() OVERRIDE;
+ virtual ImageFrame* frameBufferAtIndex(size_t) OVERRIDE;
+#ifdef WEBP_ICC_ANIMATION_SUPPORT
+ virtual void setData(SharedBuffer* data, bool allDataReceived) OVERRIDE;
+ virtual int repetitionCount() const OVERRIDE;
+ virtual bool frameIsCompleteAtIndex(size_t) const OVERRIDE;
+ virtual float frameDurationAtIndex(size_t) const OVERRIDE;
+ virtual size_t clearCacheExceptFrame(size_t) OVERRIDE;
+#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;
+ bool m_frameBackgroundHasAlpha;
#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
+ bool updateDemuxer();
+ bool initFrameBuffer(const WebPIterator&, size_t frameIndex);
+ void applyPostProcessing(size_t frameIndex);
+ virtual void clearFrameBuffer(size_t frameIndex) OVERRIDE;
+
+ WebPDemuxer* m_demux;
+ WebPDemuxState m_demuxState;
+ bool m_haveAlreadyParsedThisData;
+ bool m_haveReadAnimationParameters;
+ int m_repetitionCount;
int m_decodedHeight;
#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