| 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. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 SkDebugf("The number of devices is %u\n", deviceList.size()); | 80 SkDebugf("The number of devices is %u\n", deviceList.size()); |
| 81 | 81 |
| 82 // Print some information about the device for debugging | 82 // Print some information about the device for debugging |
| 83 *device = deviceList[0]; | 83 *device = deviceList[0]; |
| 84 cl::STRING_CLASS deviceName; | 84 cl::STRING_CLASS deviceName; |
| 85 device->getInfo(CL_DEVICE_NAME, &deviceName); | 85 device->getInfo(CL_DEVICE_NAME, &deviceName); |
| 86 SkDebugf("Device index 0 is named %s\n", deviceName.c_str()); | 86 SkDebugf("Device index 0 is named %s\n", deviceName.c_str()); |
| 87 | 87 |
| 88 // Create a CL context and check for all errors | 88 // Create a CL context and check for all errors |
| 89 cl_int contextErr = CL_SUCCESS; | 89 cl_int contextErr = CL_SUCCESS; |
| 90 *context = cl::Context(deviceList, NULL, error_notify, NULL, &contextErr); | 90 *context = cl::Context(deviceList, nullptr, error_notify, nullptr, &contextE
rr); |
| 91 if (contextErr != CL_SUCCESS) { | 91 if (contextErr != CL_SUCCESS) { |
| 92 SkDebugf("Context creation failed: %s\n", cl_error_to_string(contextErr)
); | 92 SkDebugf("Context creation failed: %s\n", cl_error_to_string(contextErr)
); |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 static bool init_cl_diff(SkImageDiffer* differ) { | 99 static bool init_cl_diff(SkImageDiffer* differ) { |
| 100 // Setup OpenCL | 100 // Setup OpenCL |
| (...skipping 10 matching lines...) Expand all Loading... |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 // TODO Find a better home for the diff registry. One possibility is to have the
differs self | 113 // TODO Find a better home for the diff registry. One possibility is to have the
differs self |
| 114 // register. | 114 // register. |
| 115 | 115 |
| 116 // List here every differ | 116 // List here every differ |
| 117 SkDifferentPixelsMetric gDiffPixel; | 117 SkDifferentPixelsMetric gDiffPixel; |
| 118 SkPMetric gPDiff; | 118 SkPMetric gPDiff; |
| 119 | 119 |
| 120 // A null terminated array of pointer to every differ declared above | 120 // A null terminated array of pointer to every differ declared above |
| 121 SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL }; | 121 SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, nullptr }; |
| 122 | 122 |
| 123 int tool_main(int argc, char * argv[]); | 123 int tool_main(int argc, char * argv[]); |
| 124 int tool_main(int argc, char * argv[]) { | 124 int tool_main(int argc, char * argv[]) { |
| 125 // Setup command line parsing | 125 // Setup command line parsing |
| 126 SkCommandLineFlags::SetUsage("Compare images using various metrics."); | 126 SkCommandLineFlags::SetUsage("Compare images using various metrics."); |
| 127 SkCommandLineFlags::Parse(argc, argv); | 127 SkCommandLineFlags::Parse(argc, argv); |
| 128 | 128 |
| 129 // Needed by various Skia components | 129 // Needed by various Skia components |
| 130 SkAutoGraphics ag; | 130 SkAutoGraphics ag; |
| 131 SkTaskGroup::Enabler enabled; | 131 SkTaskGroup::Enabler enabled; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 | 260 |
| 261 return 0; | 261 return 0; |
| 262 } | 262 } |
| 263 | 263 |
| 264 #if !defined(SK_BUILD_FOR_IOS) | 264 #if !defined(SK_BUILD_FOR_IOS) |
| 265 int main(int argc, char * argv[]) { | 265 int main(int argc, char * argv[]) { |
| 266 return tool_main(argc, (char**) argv); | 266 return tool_main(argc, (char**) argv); |
| 267 } | 267 } |
| 268 #endif | 268 #endif |
| OLD | NEW |