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

Unified Diff: Source/core/platform/image-decoders/gif/GIFImageDecoder.h

Issue 15350006: Decode GIF image frames on demand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 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/gif/GIFImageDecoder.h
diff --git a/Source/core/platform/image-decoders/gif/GIFImageDecoder.h b/Source/core/platform/image-decoders/gif/GIFImageDecoder.h
index b05f2a177f47ff3b91de6830e77d54bb26fb957d..6b57525329dba276f86c02eaa2094881ea234361 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageDecoder.h
+++ b/Source/core/platform/image-decoders/gif/GIFImageDecoder.h
@@ -27,7 +27,7 @@
#define GIFImageDecoder_h
#include "core/platform/image-decoders/ImageDecoder.h"
-#include <wtf/OwnPtr.h>
+#include "wtf/OwnPtr.h"
class GIFImageReader;
@@ -39,7 +39,7 @@ namespace WebCore {
GIFImageDecoder(ImageSource::AlphaOption, ImageSource::GammaAndColorProfileOption);
virtual ~GIFImageDecoder();
- enum GIFQuery { GIFFullQuery, GIFSizeQuery, GIFFrameCountQuery };
+ enum GIFParseQuery { GIFSizeQuery, GIFFrameCountQuery };
// ImageDecoder
virtual String filenameExtension() const { return "gif"; }
@@ -55,24 +55,30 @@ namespace WebCore {
// accessing deleted memory, especially when calling this from inside
// GIFImageReader!
virtual bool setFailed();
- virtual void clearFrameBufferCache(size_t clearBeforeFrame);
// Callbacks from the GIF reader.
- bool haveDecodedRow(unsigned frameIndex, const Vector<unsigned char>& rowBuffer, size_t width, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels);
- bool frameComplete(unsigned frameIndex, unsigned frameDuration, ImageFrame::FrameDisposalMethod disposalMethod);
- void gifComplete();
+ bool haveDecodedRow(size_t frameIndex, const Vector<unsigned char>& rowBuffer, size_t width, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels);
+ bool frameComplete(size_t frameIndex);
+
+ // For testing.
+ bool parseCompleted() const;
private:
- // If the query is GIFFullQuery, decodes the image up to (but not
- // including) |haltAtFrame|. Otherwise, decodes as much as is needed to
- // answer the query, ignoring bitmap data. If decoding fails but there
- // is no more data coming, sets the "decode failure" flag.
- void decode(unsigned haltAtFrame, GIFQuery);
+ virtual void clearFrameBuffer(size_t frameIndex) OVERRIDE;
+
+ // Parses as much as is needed to answer the query, ignoring bitmap
+ // data. If parsing fails, sets the "decode failure" flag.
+ void parse(GIFParseQuery);
+
+ // Decodes bitmap data of the frame. Depending on the disposal method
+ // of prior frames, also decodes all required prior frames. If decoding
+ // fails, sets the "decode failure" flag.
+ void decode(size_t frameIndex);
// Called to initialize the frame buffer with 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(unsigned frameIndex);
+ bool initFrameBuffer(size_t frameIndex);
bool m_currentBufferSawAlpha;
mutable int m_repetitionCount;

Powered by Google App Engine
This is Rietveld 408576698