aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CodecAnimTest.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2018-05-24 13:04:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-24 18:18:08 +0000
commit7916c0ec353e059c4979102d015931a276103fd9 (patch)
tree360289286332cfd1176fa1008dc978c267ebe69f /tests/CodecAnimTest.cpp
parenta0047bcff704a9121a6d82a6f97d6124463a2e54 (diff)
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 <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests/CodecAnimTest.cpp')
-rw-r--r--tests/CodecAnimTest.cpp22
1 files changed, 20 insertions, 2 deletions
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;
+ }
+ }
}
}
}