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

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, 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..8d40a5efc9794ae2a75f1aa942831baadf72ad14 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_ANIM_SUPPORT
Noel Gordon 2013/04/29 18:41:57 (avoid abbrevs) Make it WEBP_ANIMIMATION or some s
urvang (Google) 2013/04/30 13:14:15 Done.
Noel Gordon 2013/05/01 17:55:28 WEBP_ICC_ANIMIMATION_SUPPORT -> WEBP_ANIMIMATION_S
urvang (Google) 2013/05/01 22:25:16 This define is to show that libwebp version in use
+#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);
Noel Gordon 2013/04/29 18:41:57 s/ fIter//
urvang (Google) 2013/04/30 13:14:15 What is special about this argument? Why should we
Noel Gordon 2013/05/01 17:55:28 http://www.chromium.org/blink/coding-style Names 9
+ // 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();
Noel Gordon 2013/04/29 18:41:57 All what? clear() was fine.
urvang (Google) 2013/04/30 13:14:15 'clear()' was actually renamed to 'clearDecoder()'
+ void clearDecoder();
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698