SkWebpCodec: enable a loop count of 1
Commit 557fbb added animation support to SkWebpCodec, with the intent to match Chromium. This was during the ~1.5 year period between crbug.com/592735 and crbug.com/649264 when Chromium attempted to align WebP with GIF, and play the animation once more than the stored number (see crbug.com/592735). This was later reverted, because it means that a WebP is unable to play an animation a single time (see crbug.com/649264). This commit catches SkWebpCodec up with Chromium. Add a legacy build flag (SK_LEGACY_WEBP_LOOP_COUNT) so we can stage the change on Android. Change-Id: If07e00d5e070847ceeb9ce27cd78a846974cdb4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259161 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
parent
aebc5f8bd7
commit
ae834f5781
@ -220,12 +220,15 @@ int SkWebpCodec::onGetRepetitionCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int repCount = WebPDemuxGetI(fDemux.get(), WEBP_FF_LOOP_COUNT);
|
||||
if (0 == repCount) {
|
||||
int loopCount = WebPDemuxGetI(fDemux.get(), WEBP_FF_LOOP_COUNT);
|
||||
if (0 == loopCount) {
|
||||
return kRepetitionCountInfinite;
|
||||
}
|
||||
|
||||
return repCount;
|
||||
#ifndef SK_LEGACY_WEBP_LOOP_COUNT
|
||||
loopCount--;
|
||||
#endif
|
||||
return loopCount;
|
||||
}
|
||||
|
||||
int SkWebpCodec::onGetFrameCount() {
|
||||
|
@ -155,13 +155,22 @@ DEF_TEST(Codec_frames, r) {
|
||||
{ "images/blendBG.webp", 7,
|
||||
{ 0, kNoFrame, kNoFrame, kNoFrame, 4, 4 },
|
||||
{ kOpaque, kOpaque, kUnpremul, kOpaque, kUnpremul, kUnpremul },
|
||||
{ 525, 500, 525, 437, 609, 729, 444 }, 7,
|
||||
{ 525, 500, 525, 437, 609, 729, 444 },
|
||||
#ifdef SK_LEGACY_WEBP_LOOP_COUNT
|
||||
7,
|
||||
#else
|
||||
6,
|
||||
#endif
|
||||
{ kKeep, kKeep, kKeep, kKeep, kKeep, kKeep, kKeep } },
|
||||
{ "images/required.webp", 7,
|
||||
{ 0, 1, 1, kNoFrame, 4, 4 },
|
||||
{ kOpaque, kUnpremul, kUnpremul, kOpaque, kOpaque, kOpaque },
|
||||
{ 100, 100, 100, 100, 100, 100, 100 },
|
||||
#ifdef SK_LEGACY_WEBP_LOOP_COUNT
|
||||
1,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
{ kKeep, kRestoreBG, kKeep, kKeep, kKeep, kRestoreBG, kKeep } },
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user