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

Unified Diff: experimental/skpdiff/main.cpp

Issue 19374006: make OpenCL optional for skpdiff (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: comments 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
Index: experimental/skpdiff/main.cpp
diff --git a/experimental/skpdiff/main.cpp b/experimental/skpdiff/main.cpp
index 08435519b67c5f3aa4fb6161ceaaeed939b3c60b..175d86a8f8ba8e485fa7a36f84bd902d49b557b9 100644
--- a/experimental/skpdiff/main.cpp
+++ b/experimental/skpdiff/main.cpp
@@ -5,16 +5,20 @@
* found in the LICENSE file.
*/
+#if SK_SUPPORT_OPENCL
#define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr
#define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string
#include <CL/cl.hpp>
+#include "SkCLImageDiffer.h"
djsollen 2013/07/16 20:11:46 this is not needed.
+#endif
+
#include "SkCommandLineFlags.h"
#include "SkGraphics.h"
#include "SkStream.h"
#include "SkTDArray.h"
-#include "SkCLImageDiffer.h"
+#include "SkDifferentPixelsMetric.h"
#include "SkDiffContext.h"
#include "SkImageDiffer.h"
#include "SkPMetric.h"
@@ -31,6 +35,7 @@ DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
DEFINE_string2(output, o, "skpdiff_output.json", "Writes the output of these diffs to output: <output>");
DEFINE_bool(jsonp, true, "Output JSON with padding");
+#if SK_SUPPORT_OPENCL
/// A callback for any OpenCL errors
CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) {
SkDebugf("OpenCL error notify: %s\n", errorInfo);
@@ -72,8 +77,6 @@ static bool init_device_and_context(cl::Device* device, cl::Context* context) {
return true;
}
-
-
static bool init_cl_diff(SkImageDiffer* differ) {
// Setup OpenCL
cl::Device device;
@@ -86,6 +89,7 @@ static bool init_cl_diff(SkImageDiffer* differ) {
SkCLImageDiffer* clDiffer = (SkCLImageDiffer*)differ;
return clDiffer->init(device(), context());
}
+#endif
static bool init_dummy(SkImageDiffer* differ) {
return true;
@@ -96,7 +100,7 @@ static bool init_dummy(SkImageDiffer* differ) {
// register.
// List here every differ
-SkDifferentPixelsImageDiffer gDiffPixel;
+SkDifferentPixelsMetric gDiffPixel;
SkPMetric gPDiff;
// A null terminated array of pointer to every differ declared above
@@ -106,7 +110,15 @@ SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL };
// everything immediately is that certain differs may require special initialization, but we still
// want to construct all of them globally so they can be queried for things like their name and
// description.
-bool (*gDiffInits[])(SkImageDiffer*) = { init_cl_diff, init_dummy, NULL };
+bool (*gDiffInits[])(SkImageDiffer*) = {
+#if SK_SUPPORT_OPENCL
+ init_cl_diff,
djsollen 2013/07/16 20:11:46 why not have skImageDiffer have a static function
+#else
+ init_dummy,
+#endif
+ init_dummy,
+ NULL
+};
int main(int argc, char** argv) {

Powered by Google App Engine
This is Rietveld 408576698