skia2/dm/DMChecksumTask.cpp
mtklein@google.com ee21a3e395 DM: some refactoring
- rename ComparisonTask to ChecksumTask
  - have ChecksumTask handle all the checksum-checking
  - turn on all extra modes by default
  - simplify progress output to a countdown

BUG=
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/88543002

git-svn-id: http://skia.googlecode.com/svn/trunk@12398 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-26 18:52:31 +00:00

27 lines
644 B
C++

#include "DMChecksumTask.h"
#include "DMUtil.h"
namespace DM {
ChecksumTask::ChecksumTask(const Task& parent,
skiagm::Expectations expectations,
SkBitmap bitmap)
: Task(parent)
, fName(parent.name()) // Masquerade as parent so failures are attributed to it.
, fExpectations(expectations)
, fBitmap(bitmap)
{}
void ChecksumTask::draw() {
if (fExpectations.ignoreFailure() || fExpectations.empty()) {
return;
}
const skiagm::GmResultDigest digest(fBitmap);
if (!fExpectations.match(digest)) {
this->fail();
}
}
} // namespace DM