| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 // TODO(djsollen): Rename this whole package (perhaps to "SkMultiDiffer"). | 8 // TODO(djsollen): Rename this whole package (perhaps to "SkMultiDiffer"). |
| 9 // It's not just for "pdiff" (perceptual diffs)--it's a harness that allows | 9 // It's not just for "pdiff" (perceptual diffs)--it's a harness that allows |
| 10 // the execution of an arbitrary set of difference algorithms. | 10 // the execution of an arbitrary set of difference algorithms. |
| 11 // See http://skbug.com/2711 ('rename skpdiff') | 11 // See http://skbug.com/2711 ('rename skpdiff') |
| 12 | 12 |
| 13 #if SK_SUPPORT_OPENCL | 13 #if SK_SUPPORT_OPENCL |
| 14 | 14 |
| 15 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr | 15 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr |
| 16 #define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string | 16 #define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string |
| 17 #if SK_BUILD_FOR_MAC | 17 #if SK_BUILD_FOR_MAC |
| 18 // Note that some macs don't have this header and it can be downloaded from the
Khronos registry | 18 // Note that some macs don't have this header and it can be downloaded from the
Khronos registry |
| 19 # include <OpenCL/cl.hpp> | 19 # include <OpenCL/cl.hpp> |
| 20 #else | 20 #else |
| 21 # include <CL/cl.hpp> | 21 # include <CL/cl.hpp> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 #include "SkCommandLineFlags.h" | 26 #include "SkCommandLineFlags.h" |
| 27 #include "SkGraphics.h" | 27 #include "SkGraphics.h" |
| 28 #include "SkStream.h" | 28 #include "SkStream.h" |
| 29 #include "SkTDArray.h" | 29 #include "SkTDArray.h" |
| 30 #include "SkTaskGroup.h" | |
| 31 | 30 |
| 32 #include "SkDifferentPixelsMetric.h" | 31 #include "SkDifferentPixelsMetric.h" |
| 33 #include "SkDiffContext.h" | 32 #include "SkDiffContext.h" |
| 34 #include "SkImageDiffer.h" | 33 #include "SkImageDiffer.h" |
| 35 #include "SkPMetric.h" | 34 #include "SkPMetric.h" |
| 36 #include "skpdiff_util.h" | 35 #include "skpdiff_util.h" |
| 37 | 36 |
| 38 #include "SkForceLinking.h" | 37 #include "SkForceLinking.h" |
| 39 __SK_FORCE_IMAGE_DECODER_LINKING; | 38 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 40 | 39 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL }; | 118 SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL }; |
| 120 | 119 |
| 121 int tool_main(int argc, char * argv[]); | 120 int tool_main(int argc, char * argv[]); |
| 122 int tool_main(int argc, char * argv[]) { | 121 int tool_main(int argc, char * argv[]) { |
| 123 // Setup command line parsing | 122 // Setup command line parsing |
| 124 SkCommandLineFlags::SetUsage("Compare images using various metrics."); | 123 SkCommandLineFlags::SetUsage("Compare images using various metrics."); |
| 125 SkCommandLineFlags::Parse(argc, argv); | 124 SkCommandLineFlags::Parse(argc, argv); |
| 126 | 125 |
| 127 // Needed by various Skia components | 126 // Needed by various Skia components |
| 128 SkAutoGraphics ag; | 127 SkAutoGraphics ag; |
| 129 SkTaskGroup::Enabler enabled; | |
| 130 | 128 |
| 131 if (FLAGS_list) { | 129 if (FLAGS_list) { |
| 132 SkDebugf("Available Metrics:\n"); | 130 SkDebugf("Available Metrics:\n"); |
| 133 } | 131 } |
| 134 | 132 |
| 135 // Figure which differs the user chose, and optionally print them if the use
r requests it | 133 // Figure which differs the user chose, and optionally print them if the use
r requests it |
| 136 SkTDArray<SkImageDiffer*> chosenDiffers; | 134 SkTDArray<SkImageDiffer*> chosenDiffers; |
| 137 for (int differIndex = 0; NULL != gDiffers[differIndex]; differIndex++) { | 135 for (int differIndex = 0; NULL != gDiffers[differIndex]; differIndex++) { |
| 138 SkImageDiffer* differ = gDiffers[differIndex]; | 136 SkImageDiffer* differ = gDiffers[differIndex]; |
| 139 if (FLAGS_list) { | 137 if (FLAGS_list) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 255 } |
| 258 | 256 |
| 259 return 0; | 257 return 0; |
| 260 } | 258 } |
| 261 | 259 |
| 262 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 260 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 263 int main(int argc, char * argv[]) { | 261 int main(int argc, char * argv[]) { |
| 264 return tool_main(argc, (char**) argv); | 262 return tool_main(argc, (char**) argv); |
| 265 } | 263 } |
| 266 #endif | 264 #endif |
| OLD | NEW |