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

Unified Diff: include/codec/SkCodec.h

Issue 2447863002: Report repetition count in SkCodec (Closed)
Patch Set: Return a bool, with multiple out parameters Created 4 years, 2 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
« no previous file with comments | « gm/animatedGif.cpp ('k') | src/codec/SkCodecAnimation.h » ('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 a97a79c4bb72b78a8db383b51fa454b289025101..27b8a997e7ade596db4b024653742977b96cc645 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -604,6 +604,8 @@ public:
size_t fDuration;
};
+ static constexpr int kRepetitionCountInfinite = -1;
+
/**
* Return info about the frames in the image.
*
@@ -612,10 +614,15 @@ public:
*
* As such, future decoding calls may require a rewind.
*
- * For single-frame images, this will return an empty vector.
+ * For single-frame images, this will return false and leave the out
+ * parameters unmodified.
+ *
+ * @param outFrameInfo vector of info about each frame.
+ * @param outRepetitionCount If non-NULL, this will be set to the number of
+ * times an animated image should repeat.
reed1 2016/10/31 14:17:01 Assuming this can take nullptr for outFrameInfo, t
scroggo 2016/10/31 19:12:27 I've updated the header, and updated the test to c
*/
- std::vector<FrameInfo> getFrameInfo() {
- return this->onGetFrameInfo();
+ bool getFrameInfo(std::vector<FrameInfo>* outFrameInfo, int* outRepetitionCount) {
+ return this->onGetFrameInfo(outFrameInfo, outRepetitionCount);
}
protected:
@@ -761,9 +768,9 @@ protected:
bool initializeColorXform(const SkImageInfo& dstInfo);
SkColorSpaceXform* colorXform() const { return fColorXform.get(); }
- virtual std::vector<FrameInfo> onGetFrameInfo() {
- // empty vector - this is not animated.
- return {};
+ virtual bool onGetFrameInfo(std::vector<FrameInfo>*, int*) {
+ // default is not animated.
+ return false;
}
/**
« no previous file with comments | « gm/animatedGif.cpp ('k') | src/codec/SkCodecAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698