summaryrefslogtreecommitdiffstats
path: root/webkit/pending/GIFImageDecoder.cpp
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 22:31:35 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 22:31:35 +0000
commitde56f378336660dcc848763c80267a5e063ae47d (patch)
tree7f551b88923b35bc4022ce6ab3a3f602fb60d91c /webkit/pending/GIFImageDecoder.cpp
parentdc4f63c80cb90efe594131030aad6776e5945fcc (diff)
downloadchromium_src-de56f378336660dcc848763c80267a5e063ae47d.zip
chromium_src-de56f378336660dcc848763c80267a5e063ae47d.tar.gz
chromium_src-de56f378336660dcc848763c80267a5e063ae47d.tar.bz2
Merge the chrome_webkit_merge_branch back on to trunk. This brings us
up to webkit@36102. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/pending/GIFImageDecoder.cpp')
-rw-r--r--webkit/pending/GIFImageDecoder.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/webkit/pending/GIFImageDecoder.cpp b/webkit/pending/GIFImageDecoder.cpp
index 4e94bfbd..d350d2c 100644
--- a/webkit/pending/GIFImageDecoder.cpp
+++ b/webkit/pending/GIFImageDecoder.cpp
@@ -86,7 +86,7 @@ private:
};
GIFImageDecoder::GIFImageDecoder()
-: m_frameCountValid(true), m_reader(0)
+: m_frameCountValid(true), m_repetitionCount(cAnimationLoopOnce), m_reader(0)
{}
GIFImageDecoder::~GIFImageDecoder()
@@ -150,11 +150,16 @@ int GIFImageDecoder::frameCount()
// The number of repetitions to perform for an animation loop.
int GIFImageDecoder::repetitionCount() const
{
- // We don't have to do any decoding to determine this, since the loop count was determined after
- // the initial query for size.
+ // This value can arrive at any point in the image data stream. Most GIFs
+ // in the wild declare it near the beginning of the file, so it usually is
+ // set by the time we've decoded the size, but (depending on the GIF and the
+ // packets sent back by the webserver) not always. Our caller is
+ // responsible for waiting until image decoding has finished to ask this if
+ // it needs an authoritative answer. In the meantime, we should default to
+ // "loop once", both in the reader and here.
if (m_reader)
- return m_reader->repetitionCount();
- return cAnimationNone;
+ m_repetitionCount = m_reader->repetitionCount();
+ return m_repetitionCount;
}
RGBA32Buffer* GIFImageDecoder::frameBufferAtIndex(size_t index)
@@ -401,6 +406,8 @@ void GIFImageDecoder::frameComplete(unsigned frameIndex, unsigned frameDuration,
void GIFImageDecoder::gifComplete()
{
+ if (m_reader)
+ m_repetitionCount = m_reader->repetitionCount();
delete m_reader;
m_reader = 0;
}