DM: duh, don't calculate digests unless we're going to look at them.
This doesn't cut the runtime significantly (~6s either way) but it does cut the CPU time down from ~10s to ~6s.
BUG=
R=bungeman@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/27476007
git-svn-id: http://skia.googlecode.com/svn/trunk@11826 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/dm/DMReplayTask.cpp b/dm/DMReplayTask.cpp
index 7e183f6..e5f392c 100644
--- a/dm/DMReplayTask.cpp
+++ b/dm/DMReplayTask.cpp
@@ -8,13 +8,11 @@
ReplayTask::ReplayTask(const char* suffix,
const Task& parent,
skiagm::GM* gm,
- skiagm::GmResultDigest reference,
- SkBitmap::Config config)
+ SkBitmap reference)
: Task(parent)
, fName(underJoin(parent.name().c_str(), suffix))
, fGM(gm)
, fReference(reference)
- , fConfig(config)
{}
void ReplayTask::draw() {
@@ -30,7 +28,9 @@
picture.endRecording();
SkBitmap bitmap;
- bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt(fGM->height()));
+ bitmap.setConfig(fReference.config(),
+ SkScalarCeilToInt(fGM->width()),
+ SkScalarCeilToInt(fGM->height()));
bitmap.allocPixels();
bitmap.eraseColor(0x00000000);
@@ -38,8 +38,10 @@
replay.drawPicture(picture);
replay.flush();
- const skiagm::GmResultDigest replayDigest(bitmap);
- if (!replayDigest.equals(fReference)) {
+ const SkAutoLockPixels mine(bitmap), theirs(fReference);
+ if (bitmap.getSize() != fReference.getSize() ||
+ 0 != memcmp(bitmap.getPixels(), fReference.getPixels(), bitmap.getSize()))
+ {
this->fail();
}
}