diff options
author | 2017-06-07 12:31:51 -0400 | |
---|---|---|
committer | 2017-06-07 20:15:17 +0000 | |
commit | 33deb7ed4d583c88187ba240efb749e9a1fd6843 (patch) | |
tree | cf70e6f7dbd360853b84e16d586f5b8811b68c8f /tests/CodecTest.cpp | |
parent | 9982c4eb76af58e18df2cd3dd81913439f1b6157 (diff) |
Make SkCodec more flexible about its required frame
SkCodec sets fRequiredFrame to be the earliest possible frame that a
given frame can depend on. e.g.
- Frame A fills the screen, Keep
- Frame B does not cover A, Keep
- Frame C covers B but not A, and is opaque
Frame C can depend on either A or B. SkCodec already reports that C
depends on A. This CL allows a client of SkCodec to use either A or
B to create C.
Also expose the DisposalMethod. Since any frame between A and C can
be used to create C except for DisposePrevious frames, the client
needs to be able to know the disposal method so they do not try to
use such a frame to create C.
Further, the disposal method can be used to give the client a better
idea whether they will continue to need a frame. (e.g. if frame i is
DisposePrevious and depends on i-1, the client may not want to steal
i-1 to create i, since i+1 may also depend on i-1.)
TODO: Share code for decoding prior frames between GIF and WEBP
Change-Id: I91a5ae22ba3d8dfbe0bde833fa67ae3da0d81ed6
Reviewed-on: https://skia-review.googlesource.com/13722
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Chris Blume <cblume@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests/CodecTest.cpp')
-rw-r--r-- | tests/CodecTest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp index ffaeb2b61c..f839aaad80 100644 --- a/tests/CodecTest.cpp +++ b/tests/CodecTest.cpp @@ -1514,7 +1514,8 @@ DEF_TEST(Codec_InvalidAnimated, r) { SkCodec::Options opts; for (int i = 0; static_cast<size_t>(i) < frameInfos.size(); i++) { opts.fFrameIndex = i; - opts.fHasPriorFrame = frameInfos[i].fRequiredFrame == i - 1; + const auto reqFrame = frameInfos[i].fRequiredFrame; + opts.fPriorFrame = reqFrame == i - 1 ? reqFrame : SkCodec::kNone; auto result = codec->startIncrementalDecode(info, bm.getPixels(), bm.rowBytes(), &opts); if (result != SkCodec::kSuccess) { ERRORF(r, "Failed to start decoding frame %i (out of %i) with error %i\n", i, |