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

Unified Diff: Source/core/platform/image-decoders/gif/GIFImageReader.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/GIFImageReader.h
diff --git a/Source/core/platform/image-decoders/gif/GIFImageReader.h b/Source/core/platform/image-decoders/gif/GIFImageReader.h
index 105cd655e692776bf219a260e57dd2e1ef61d0fa..1c64bffc8c1054f1627ad101a1f6c0699d66b190 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageReader.h
+++ b/Source/core/platform/image-decoders/gif/GIFImageReader.h
@@ -213,7 +213,7 @@ public:
datasize = size;
m_isDataSizeDefined = true;
}
-
+ void clearDecodeState() { m_lzwContext.clear(); }
private:
OwnPtr<GIFLZWContext> m_lzwContext;
Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame.
@@ -239,7 +239,6 @@ public:
, m_globalColormapPosition(0)
, m_globalColormapSize(0)
, m_loopCount(cLoopCountNotSeen)
- , m_currentDecodingFrame(0)
, m_parseCompleted(false)
{
}
@@ -249,8 +248,8 @@ public:
}
void setData(PassRefPtr<WebCore::SharedBuffer> data) { m_data = data; }
- // FIXME: haltAtFrame should be size_t.
- bool decode(WebCore::GIFImageDecoder::GIFQuery, unsigned haltAtFrame);
+ bool parse(WebCore::GIFImageDecoder::GIFParseQuery);
+ bool decode(size_t frameIndex);
Peter Kasting 2013/05/24 03:15:22 Thumbs up on improving the API here to be noticeab
size_t imagesCount() const
{
@@ -289,8 +288,10 @@ public:
bool parseCompleted() const { return m_parseCompleted; }
+ void clearDecodeState(size_t index) { m_frames[index]->clearDecodeState(); }
+
private:
- bool parse(size_t dataPosition, size_t len, bool parseSizeOnly);
+ bool parseData(size_t dataPosition, size_t len, WebCore::GIFImageDecoder::GIFParseQuery);
void setRemainingBytes(size_t);
const unsigned char* data(size_t dataPosition) const
@@ -322,7 +323,6 @@ private:
int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders.
Vector<OwnPtr<GIFFrameContext> > m_frames;
- size_t m_currentDecodingFrame;
RefPtr<WebCore::SharedBuffer> m_data;
bool m_parseCompleted;

Powered by Google App Engine
This is Rietveld 408576698