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

Unified Diff: third_party/gif/SkGifImageReader.cpp

Issue 2447863002: Report repetition count in SkCodec (Closed)
Patch Set: Make colorTables.gif use a different loop count Created 4 years, 1 month 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
« no previous file with comments | « third_party/gif/SkGifImageReader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gif/SkGifImageReader.cpp
diff --git a/third_party/gif/SkGifImageReader.cpp b/third_party/gif/SkGifImageReader.cpp
index bbf5f9a2f0f41052eba9049aa0720c12531d657c..0ffc7ca72a4b7e5ea2e8b30ddebff8c97edf79ba 100644
--- a/third_party/gif/SkGifImageReader.cpp
+++ b/third_party/gif/SkGifImageReader.cpp
@@ -415,6 +415,11 @@ bool SkGifImageReader::parse(SkGifImageReader::SkGIFParseQuery query)
return true;
}
+ if (SkGIFLoopCountQuery == query && m_loopCount != cLoopCountNotSeen) {
+ // Loop count has already been parsed.
+ return true;
+ }
+
// SkGIFSizeQuery and SkGIFFrameCountQuery are negative, so this is only meaningful when >= 0.
const int lastFrameToParse = (int) query;
if (lastFrameToParse >= 0 && (int) m_frames.size() > lastFrameToParse
@@ -664,9 +669,14 @@ bool SkGifImageReader::parse(SkGifImageReader::SkGIFParseQuery query)
// Zero loop count is infinite animation loop request.
if (!m_loopCount)
- m_loopCount = SkCodecAnimation::kAnimationLoopInfinite;
+ m_loopCount = SkCodec::kRepetitionCountInfinite;
GETN(1, SkGIFNetscapeExtensionBlock);
+
+ if (SkGIFLoopCountQuery == query) {
+ m_streamBuffer.flush();
+ return true;
+ }
} else if (netscapeExtension == 2) {
// Wait for specified # of bytes to enter buffer.
« no previous file with comments | « third_party/gif/SkGifImageReader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698