aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec/SkCodec.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/codec/SkCodec.h')
-rw-r--r--include/codec/SkCodec.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 6d4352214c..aadcb059fe 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -593,6 +593,15 @@ public:
*/
int outputScanline(int inputScanline) const;
+ /**
+ * Return the number of frames in the image.
+ *
+ * May require reading through the stream.
+ */
+ size_t getFrameCount() {
+ return this->onGetFrameCount();
+ }
+
// The required frame for an independent frame is marked as
// kNone.
static constexpr size_t kNone = static_cast<size_t>(-1);
@@ -628,7 +637,18 @@ public:
};
/**
- * Return info about the frames in the image.
+ * Return info about a single frame.
+ *
+ * Only supported by multi-frame images. Does not read through the stream,
+ * so it should be called after getFrameCount() to parse any frames that
+ * have not already been parsed.
+ */
+ bool getFrameInfo(size_t index, FrameInfo* info) const {
+ return this->onGetFrameInfo(index, info);
+ }
+
+ /**
+ * Return info about all the frames in the image.
*
* May require reading through the stream to determine info about the
* frames (including the count).
@@ -637,9 +657,7 @@ public:
*
* For single-frame images, this will return an empty vector.
*/
- std::vector<FrameInfo> getFrameInfo() {
- return this->onGetFrameInfo();
- }
+ std::vector<FrameInfo> getFrameInfo();
static constexpr int kRepetitionCountInfinite = -1;
@@ -800,9 +818,12 @@ protected:
SkTransferFunctionBehavior premulBehavior);
SkColorSpaceXform* colorXform() const { return fColorXform.get(); }
- virtual std::vector<FrameInfo> onGetFrameInfo() {
- // empty vector - this is not animated.
- return std::vector<FrameInfo>{};
+ virtual size_t onGetFrameCount() {
+ return 1;
+ }
+
+ virtual bool onGetFrameInfo(size_t, FrameInfo*) const {
+ return false;
}
virtual int onGetRepetitionCount() {