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

Unified Diff: include/codec/SkCodec.h

Issue 2045293002: Add support for multiple frames in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Return metadata in a vector Created 4 years, 3 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 664dc561080bb39a76c8d09a35b6cb19fad8a0a7..b991ecab3aada96c94afab94ed294430b7bf6e48 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -18,6 +18,8 @@
#include "SkTypes.h"
#include "SkYUVSizeInfo.h"
+#include <vector>
+
class SkColorSpace;
class SkData;
class SkPngChunkReader;
@@ -606,38 +608,38 @@ public:
*/
int outputScanline(int inputScanline) const;
- /**
- * Return the number of frames in the image.
- *
- * May require reading through the stream to determine the number of
- * frames.
- *
- * As such, future decoding calls may require a rewind.
- */
- size_t getFrameCount() {
- return this->onGetFrameCount();
- }
-
// The required frame for an independent frame is marked as
// kIndependentFrame.
static constexpr size_t kIndependentFrame = static_cast<size_t>(-1);
/**
- * For a multiframed image, return the image that frame |index| needs to
- * be blended with.
- *
- * If the frame needs no blending, return kIndependentFrame.
+ * Information about individual frames in a multi-framed image.
*/
- size_t getRequiredFrame(size_t index) {
- return this->onGetRequiredFrame(index);
- }
+ struct FrameInfo {
+ /**
+ * The frame that this frame needs to be blended with, or
+ * kIndependentFrame.
+ */
+ size_t fRequiredFrame;
+
+ /**
+ * Number of 1/100 seconds to show this frame.
+ */
+ size_t fDuration;
+ };
/**
- * For a multiframed image, return the number of 1/100 seconds to
- * show frame |index|.
+ * Return info about the frames in the image.
+ *
+ * May require reading through the stream to determine the number of
+ * frames.
+ *
+ * As such, future decoding calls may require a rewind.
+ *
+ * For single-frame images, this will return an empty vector.
*/
- size_t getFrameDuration(size_t index) {
- return this->onGetFrameDuration(index);
+ std::vector<FrameInfo> getFrameInfo() {
scroggo 2016/09/26 15:51:43 sgtm
+ return this->onGetFrameInfo();
}
protected:
@@ -780,16 +782,9 @@ protected:
virtual int onOutputScanline(int inputScanline) const;
- virtual size_t onGetFrameCount() {
- return 1;
- }
-
- virtual size_t onGetRequiredFrame(size_t) {
- return kIndependentFrame;
- }
-
- virtual size_t onGetFrameDuration(size_t) {
- return 0;
+ virtual std::vector<FrameInfo> onGetFrameInfo() {
+ // empty vector - this is not animated.
+ return {};
}
/**
« 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