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

Unified Diff: tools/image_expectations.h

Issue 273703006: extract some common code from PictureRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add TODO Created 6 years, 7 months 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: tools/image_expectations.h
diff --git a/tools/image_expectations.h b/tools/image_expectations.h
new file mode 100644
index 0000000000000000000000000000000000000000..432cf6d3a80bd3f4cbe2e563c2c0d4116a47d7a5
--- /dev/null
+++ b/tools/image_expectations.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef image_expectations_DEFINED
+#define image_expectations_DEFINED
+
+#include "SkBitmap.h"
+#include "SkJSONCPP.h"
+
+namespace sk_tools {
+
+ /**
+ * Class for collecting image results (checksums) as we go.
+ */
+ class ImageResultsSummary {
+ public:
+ /**
+ * Adds this image to the summary of results.
+ *
+ * @param sourceName name of the source file that generated this result
+ * @param fileName relative path to the image output file on local disk
+ * @param hash hash to store
+ * @param tileNumber if not NULL, ptr to tile number
+ */
+ void add(const char *sourceName, const char *fileName, uint64_t hash,
+ const int *tileNumber=NULL);
+
+ /**
+ * Adds this image to the summary of results.
+ *
+ * @param sourceName name of the source file that generated this result
+ * @param fileName relative path to the image output file on local disk
+ * @param bitmap bitmap to store the hash of
+ * @param tileNumber if not NULL, ptr to tile number
+ */
+ void add(const char *sourceName, const char *fileName, const SkBitmap& bitmap,
+ const int *tileNumber=NULL);
+
+ /**
+ * Writes the summary (as constructed so far) to a file.
+ *
+ * @param filename path to write the summary to
+ */
+ void writeToFile(const char *filename);
+
+ private:
+ Json::Value fActualResults;
+ };
+
+} // namespace sk_tools
+
+#endif // image_expectations_DEFINED
« gyp/tools.gyp ('K') | « tools/PictureRenderer.cpp ('k') | tools/image_expectations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698