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>
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
index a3e16c6..4e069c1 100644
--- a/tests/CodecAnimTest.cpp
+++ b/tests/CodecAnimTest.cpp
@@ -422,9 +422,27 @@
             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;
+                }
+            }
         }
     }
 }