Chromium Code Reviews| 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 {}; |
| } |
| /** |