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

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..e5b9d7a737bfb9f2810e20001c6b691338327b7f 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.
@@ -231,7 +231,6 @@ public:
, m_state(GIFType)
, m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" or "GIF89a".
, m_bytesRead(0)
- , m_screenBgcolor(0)
, m_version(0)
, m_screenWidth(0)
, m_screenHeight(0)
@@ -239,7 +238,6 @@ public:
, m_globalColormapPosition(0)
, m_globalColormapSize(0)
, m_loopCount(cLoopCountNotSeen)
- , m_currentDecodingFrame(0)
, m_parseCompleted(false)
{
}
@@ -249,8 +247,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);
size_t imagesCount() const
{
@@ -289,8 +287,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
@@ -312,7 +312,6 @@ private:
size_t m_bytesRead; // Number of bytes processed.
// Global (multi-image) state.
- int m_screenBgcolor; // Logical screen background color.
int m_version; // Either 89 for GIF89 or 87 for GIF87.
unsigned m_screenWidth; // Logical screen width & height.
unsigned m_screenHeight;
@@ -322,7 +321,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