From 7916c0ec353e059c4979102d015931a276103fd9 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 24 May 2018 13:04:06 -0400 Subject: Properly zero in webp if no prior frame When erasing the prior frame rect, we need to update the frame rect to take scaling into account. We already do if the prior frame was provided; also do so if it was not provided. Note that this only affects an image with a restore previous frame that is being scaled. webp does not support restore previous, so this will not affect AnimatedImageDrawable in Android. Change-Id: I2d9a4ad45262a0e7afd1134958aff5c6e2ca6687 Reviewed-on: https://skia-review.googlesource.com/115646 Reviewed-by: Derek Sollenberger Commit-Queue: Leon Scroggins --- tests/CodecAnimTest.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'tests/CodecAnimTest.cpp') diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp index a3e16c6aa5..4e069c17fb 100644 --- a/tests/CodecAnimTest.cpp +++ b/tests/CodecAnimTest.cpp @@ -422,9 +422,27 @@ DEF_TEST(AndroidCodec_animated, r) { options.fPriorFrame = i - 1; info = info.makeAlphaType(frameInfo.fAlphaType); - const auto result = codec->codec()->getPixels(info, bm.getPixels(), bm.rowBytes(), - &options); + auto result = codec->codec()->getPixels(info, bm.getPixels(), bm.rowBytes(), + &options); REPORTER_ASSERT(r, result == SkCodec::kSuccess); + + // Now compare to not using prior frame. + SkBitmap bm2; + bm2.allocPixels(info); + + options.fPriorFrame = SkCodec::kNone; + result = codec->codec()->getPixels(info, bm2.getPixels(), bm2.rowBytes(), + &options); + REPORTER_ASSERT(r, result == SkCodec::kSuccess); + + for (int y = 0; y < info.height(); ++y) { + if (memcmp(bm.getAddr32(0, y), bm2.getAddr32(0, y), info.minRowBytes())) { + ERRORF(r, "pixel mismatch for sample size %i, frame %i resulting in " + "dimensions %i x %i line %i\n", + sampleSize, i, info.width(), info.height(), y); + break; + } + } } } } -- cgit v1.2.3