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

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: 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..b643fb7007fd59bff4e5021fc2723697f3e39e3f 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,55 @@ 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() OVERRIDE const { return "webp"; }
+ virtual bool isSizeAvailable() OVERRIDE;
+ virtual size_t frameCount() OVERRIDE;
+ virtual ImageFrame* frameBufferAtIndex(size_t index) OVERRIDE;
Noel Gordon 2013/06/13 15:50:17 nit: s/index//
urvang (Google) 2013/06/14 01:13:13 Done.
+#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;
#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;
- int m_decodedHeight;
+#endif
+
+#ifdef WEBP_ICC_ANIMATION_SUPPORT
+ 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, marks the image as failed.
+ 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; // Number of rows decoded and post-processed so far in the current frame.
#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