diff options
author | scroggo <scroggo@chromium.org> | 2016-11-01 08:28:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-01 08:28:28 -0700 |
commit | e71b1a1496738ebce4a8cac4ffa5ee1413996542 (patch) | |
tree | 725838575056d43c89536794e9e4f0c8c063f749 /src/codec/SkGifCodec.cpp | |
parent | c25c5d73e9f4d840dc758c399496d5690709ad58 (diff) |
Report repetition count in SkCodec
Add a new accessor to retrieve the repetition count.
Remove constants (and corresponding copyright) in SkCodecAnimation.
These may make sense for the calling code, but are not needed here.
kRepetitionCountInfinite corresponds to Blink's kAnimationLoopInfinite.
Move cLoopCountNotSeen to private. It is used to determine whether we
still need to parse. Add a new enum to the parse query - only parse
enough to determine the repetition count.
Unlike Chromium, SkGifCodec does not account for deleting the reader
(which SkGifCodec does not do) or failed decodes.
Add a test.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2447863002
Review-Url: https://codereview.chromium.org/2447863002
Diffstat (limited to 'src/codec/SkGifCodec.cpp')
-rw-r--r-- | src/codec/SkGifCodec.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp index 13223960c8..277da03191 100644 --- a/src/codec/SkGifCodec.cpp +++ b/src/codec/SkGifCodec.cpp @@ -139,6 +139,11 @@ std::vector<SkCodec::FrameInfo> SkGifCodec::onGetFrameInfo() { return result; } +int SkGifCodec::onGetRepetitionCount() { + fReader->parse(SkGifImageReader::SkGIFLoopCountQuery); + return fReader->loopCount(); +} + void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIndex) { fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex); fCurrColorTableIsReal = fCurrColorTable; |