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

Unified Diff: experimental/skpdiff/SkImageDiffer.h

Issue 16284007: add skpdiff tool to compare bitmaps (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add commmand line opts Created 7 years, 6 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
« no previous file with comments | « experimental/skpdiff/SkCLImageDiffer.cpp ('k') | experimental/skpdiff/SkImageDiffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/skpdiff/SkImageDiffer.h
diff --git a/experimental/skpdiff/SkImageDiffer.h b/experimental/skpdiff/SkImageDiffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..86cf5bf8013efd3109c8b4b5d16505c20a26ba0c
--- /dev/null
+++ b/experimental/skpdiff/SkImageDiffer.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkImageDiffer_DEFINED
+#define SkImageDiffer_DEFINED
+
+class SkBitmap;
+
+/**
+ * Encapsulates an image difference metric algorithm that can be potentially run asynchronously.
+ */
+class SkImageDiffer {
+public:
+ SkImageDiffer();
+ virtual ~SkImageDiffer();
+
+ /**
+ * Gets a unique and descriptive name of this differ
+ * @return A statically allocated null terminated string that is the name of this differ
+ */
+ virtual const char* getName() = 0;
+
+ /**
+ * Gets if this differ is in a usable state
+ * @return True if this differ can be used, false otherwise
+ */
+ bool isGood() { return fIsGood; }
+
+ /**
+ * Wraps a call to queueDiff by loading the given filenames into SkBitmaps
+ * @param baseline The file path of the baseline image
+ * @param test The file path of the test image
+ * @return The results of queueDiff with the loaded bitmaps
+ */
+ int queueDiffOfFile(const char baseline[], const char test[]);
+
+ /**
+ * Queues a diff on a pair of bitmaps to be done at some future time.
+ * @param baseline The correct bitmap
+ * @param test The bitmap whose difference is being tested
+ * @return An non-negative diff ID on success, a negative integer on failure.
+ */
+ virtual int queueDiff(SkBitmap* baseline, SkBitmap* test) = 0;
+
+ /**
+ * Gets whether a queued diff of the given id has finished
+ * @param id The id of the queued diff to query
+ * @return True if the queued diff is finished and has results, false otherwise
+ */
+ virtual bool isFinished(int id) = 0;
+
+ /**
+ * Gets the results of the queued diff of the given id. The results are only meaningful after
+ * the queued diff has finished.
+ * @param id The id of the queued diff to query
+ * @return A score between of how different the compared images are, with lower numbers being
+ * more different.
+ */
+ virtual double getResult(int id) = 0;
+
+protected:
+ bool fIsGood;
+};
+
+
+#endif
« no previous file with comments | « experimental/skpdiff/SkCLImageDiffer.cpp ('k') | experimental/skpdiff/SkImageDiffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698