Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: dm/DMChecksumTask.cpp

Issue 88543002: DM: some refactoring (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698