Chromium Code Reviews| Index: dm/DMChecksumTask.cpp |
| diff --git a/dm/DMChecksumTask.cpp b/dm/DMChecksumTask.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0d9dce7fd1f85ff28c6ad62072aa87bf5adf7fee |
| --- /dev/null |
| +++ b/dm/DMChecksumTask.cpp |
| @@ -0,0 +1,26 @@ |
| +#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) |
|
epoger
2013/11/26 17:55:22
I take it that copying the SkBitmap struct is pret
bsalomon
2013/11/26 18:21:52
bitmap is very shallow.
mtklein
2013/11/26 18:25:30
Yes, copying SkBitmap is trivially cheap. This cl
|
| + {} |
| + |
| +void ChecksumTask::draw() { |
| + if (fExpectations.ignoreFailure() || fExpectations.empty()) { |
| + return; |
| + } |
| + |
| + const skiagm::GmResultDigest digest(fBitmap); |
| + if (!fExpectations.match(digest)) { |
| + this->fail(); |
| + } |
| +} |
| + |
| +} // namespace DM |