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

Unified Diff: experimental/skpdiff/SkDifferentPixelsMetric.h

Issue 19374006: make OpenCL optional for skpdiff (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: this-> Created 7 years, 5 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/SkDifferentPixelsMetric_cpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/skpdiff/SkDifferentPixelsMetric.h
diff --git a/experimental/skpdiff/SkDifferentPixelsMetric.h b/experimental/skpdiff/SkDifferentPixelsMetric.h
new file mode 100644
index 0000000000000000000000000000000000000000..38fa5ac55c826e59a02b67a82d2d199791b914e1
--- /dev/null
+++ b/experimental/skpdiff/SkDifferentPixelsMetric.h
@@ -0,0 +1,57 @@
+/*
+ * 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 SkDifferentPixelsMetric_DEFINED
+#define SkDifferentPixelsMetric_DEFINED
+
+#include "SkTDArray.h"
+
+#if SK_SUPPORT_OPENCL
+#include "SkCLImageDiffer.h"
+#else
+#include "SkImageDiffer.h"
+#endif
+
+/**
+ * A differ that measures the percentage of different corresponding pixels. If the two images are
+ * not the same size or have no pixels, the result will always be zero.
+ */
+class SkDifferentPixelsMetric :
+#if SK_SUPPORT_OPENCL
+ public SkCLImageDiffer {
+#else
+ public SkImageDiffer {
+#endif
+public:
+ virtual const char* getName() SK_OVERRIDE;
+ virtual int queueDiff(SkBitmap* baseline, SkBitmap* test) SK_OVERRIDE;
+ virtual void deleteDiff(int id) SK_OVERRIDE;
+ virtual bool isFinished(int id) SK_OVERRIDE;
+ virtual double getResult(int id) SK_OVERRIDE;
+ virtual int getPointsOfInterestCount(int id) SK_OVERRIDE;
+ virtual SkIPoint* getPointsOfInterest(int id) SK_OVERRIDE;
+
+protected:
+#if SK_SUPPORT_OPENCL
+ virtual bool onInit() SK_OVERRIDE;
+#endif
+
+private:
+ struct QueuedDiff;
+
+ SkTDArray<QueuedDiff> fQueuedDiffs;
+
+#if SK_SUPPORT_OPENCL
+ cl_kernel fKernel;
+
+ typedef SkCLImageDiffer INHERITED;
+#else
+ typedef SkImageDiffer INHERITED;
+#endif
+};
+
+#endif
« no previous file with comments | « experimental/skpdiff/SkCLImageDiffer.cpp ('k') | experimental/skpdiff/SkDifferentPixelsMetric_cpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698