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

Unified Diff: Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 284043003: Looping of animated WebP: Loop count off-by-one (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments Created 6 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/platform/image-decoders/webp/WEBPImageDecoder.cpp
diff --git a/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp b/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
index 196db5d10ab630b3548be615db8bd0996d251550..df4c303d8bc14a35d86f14681073ccdc236e7ae3 100644
--- a/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -229,8 +229,12 @@ bool WEBPImageDecoder::updateDemuxer()
// This is because ANIM chunk always precedes ANMF chunks.
m_repetitionCount = WebPDemuxGetI(m_demux, WEBP_FF_LOOP_COUNT);
ASSERT(m_repetitionCount == (m_repetitionCount & 0xffff)); // Loop count is always <= 16 bits.
- if (!m_repetitionCount)
- m_repetitionCount = cAnimationLoopInfinite;
+ // |m_repetitionCount| is the total number of animation cycles to show,
+ // with 0 meaning "infinite". But ImageSource::repetitionCount()
+ // returns -1 for "infinite", and 0 and up for "show the animation one
+ // cycle more than this value". By subtracting one here, we convert
+ // both finite and infinite cases correctly.
+ --m_repetitionCount;
m_haveReadAnimationParameters = true;
}
« no previous file with comments | « Source/platform/graphics/ImageSource.h ('k') | Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698