Chromium Code Reviews| 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..f0a9ef37c00e5480b458e6a7a7b1cdcf029e5478 100644 |
| --- a/Source/core/platform/image-decoders/gif/GIFImageDecoder.h |
| +++ b/Source/core/platform/image-decoders/gif/GIFImageDecoder.h |
| @@ -27,7 +27,9 @@ |
| #define GIFImageDecoder_h |
| #include "core/platform/image-decoders/ImageDecoder.h" |
| -#include <wtf/OwnPtr.h> |
| +#include "wtf/BitVector.h" |
| +#include "wtf/NotFound.h" |
| +#include "wtf/OwnPtr.h" |
| class GIFImageReader; |
| @@ -39,7 +41,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"; } |
| @@ -58,21 +60,34 @@ namespace WebCore { |
| 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); |
| + 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, unsigned frameDuration, ImageFrame::FrameDisposalMethod); |
| void gifComplete(); |
|
Alpha Left Google
2013/05/18 00:39:35
I suggest removing this method. This used to mean
Xianzhu
2013/05/20 04:30:59
Done.
|
| 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); |
| + // Parses as much as is needed to answer the query, ignoring bitmap |
| + // data. If parsing fails but there is no more data coming, sets the |
|
Alpha Left Google
2013/05/18 00:39:35
If parsing fails we report an error anyway, regard
Xianzhu
2013/05/20 04:30:59
Done.
|
| + // "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 but there is no more data coming, sets the "decode failure" |
| + // flag. |
| + void decode(size_t frameIndex); |
| + |
| + // Gets all frames that need to be decoded for decoding the given frame, |
| + // not including completed frames. |
| + void getFramesToDecode(size_t frameIndex, BitVector* frames); |
| + |
| + // Gets the previous required frame for decoding the given frame. |
| + // Returns notFound if there is no previous required frame. |
| + size_t getPreviousRequiredFrame(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; |