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

Unified Diff: include/codec/SkCodec.h

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 | « no previous file | resources/colorTables.gif » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index c2519cb840a54dbf0f41ee54384b3b68bdc51178..f2a717c7165def1e8dbae9e76121201a1cf50654 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -607,8 +607,8 @@ public:
/**
* Return info about the frames in the image.
*
- * May require reading through the stream to determine the number of
- * frames.
+ * May require reading through the stream to determine info about the
+ * frames (including the count).
*
* As such, future decoding calls may require a rewind.
*
@@ -618,6 +618,21 @@ public:
return this->onGetFrameInfo();
}
+ static constexpr int kRepetitionCountInfinite = -1;
+
+ /**
+ * Return the number of times to repeat, if this image is animated.
+ *
+ * May require reading the stream to find the repetition count.
+ *
+ * As such, future decoding calls may require a rewind.
+ *
+ * For single-frame images, this will return 0.
+ */
+ int getRepetitionCount() {
+ return this->onGetRepetitionCount();
+ }
+
protected:
/**
* Takes ownership of SkStream*
@@ -766,6 +781,10 @@ protected:
return {};
}
+ virtual int onGetRepetitionCount() {
+ return 0;
+ }
+
/**
* Used for testing with qcms.
* FIXME: Remove this when we are done comparing with qcms.
« no previous file with comments | « no previous file | resources/colorTables.gif » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698