| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
y default"); | 42 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
y default"); |
| 43 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names
: <baseline folder> <test folder>"); | 43 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names
: <baseline folder> <test folder>"); |
| 44 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
<test>"); | 44 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
<test>"); |
| 45 DEFINE_string2(output, o, "", "Writes a JSON summary of these diffs to file: <fi
lepath>"); | 45 DEFINE_string2(output, o, "", "Writes a JSON summary of these diffs to file: <fi
lepath>"); |
| 46 DEFINE_string(alphaDir, "", "If the differ can generate an alpha mask, write it
into directory: <dirpath>"); | 46 DEFINE_string(alphaDir, "", "If the differ can generate an alpha mask, write it
into directory: <dirpath>"); |
| 47 DEFINE_string(rgbDiffDir, "", "If the differ can generate an image showing the R
GB diff at each pixel, write it into directory: <dirpath>"); | 47 DEFINE_string(rgbDiffDir, "", "If the differ can generate an image showing the R
GB diff at each pixel, write it into directory: <dirpath>"); |
| 48 DEFINE_string(whiteDiffDir, "", "If the differ can generate an image showing eve
ry changed pixel in white, write it into directory: <dirpath>"); | 48 DEFINE_string(whiteDiffDir, "", "If the differ can generate an image showing eve
ry changed pixel in white, write it into directory: <dirpath>"); |
| 49 DEFINE_bool(jsonp, true, "Output JSON with padding"); | 49 DEFINE_bool(jsonp, true, "Output JSON with padding"); |
| 50 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file: <filepat
h>"); | 50 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file: <filepat
h>"); |
| 51 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP
Us available]"); | 51 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP
Us available]"); |
| 52 DEFINE_bool(longnames, false, "Output image names are a combination of baseline
and test names"); |
| 52 | 53 |
| 53 #if SK_SUPPORT_OPENCL | 54 #if SK_SUPPORT_OPENCL |
| 54 /// A callback for any OpenCL errors | 55 /// A callback for any OpenCL errors |
| 55 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI
nfoSize, ::size_t cb, void* userData) { | 56 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI
nfoSize, ::size_t cb, void* userData) { |
| 56 SkDebugf("OpenCL error notify: %s\n", errorInfo); | 57 SkDebugf("OpenCL error notify: %s\n", errorInfo); |
| 57 exit(1); | 58 exit(1); |
| 58 } | 59 } |
| 59 | 60 |
| 60 /// Creates a device and context with OpenCL | 61 /// Creates a device and context with OpenCL |
| 61 static bool init_device_and_context(cl::Device* device, cl::Context* context) { | 62 static bool init_device_and_context(cl::Device* device, cl::Context* context) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 SkDebugf("alphaDir flag expects one argument: <directory>\n"); | 200 SkDebugf("alphaDir flag expects one argument: <directory>\n"); |
| 200 return 1; | 201 return 1; |
| 201 } | 202 } |
| 202 } | 203 } |
| 203 if (!FLAGS_rgbDiffDir.isEmpty()) { | 204 if (!FLAGS_rgbDiffDir.isEmpty()) { |
| 204 if (1 != FLAGS_rgbDiffDir.count()) { | 205 if (1 != FLAGS_rgbDiffDir.count()) { |
| 205 SkDebugf("rgbDiffDir flag expects one argument: <directory>\n"); | 206 SkDebugf("rgbDiffDir flag expects one argument: <directory>\n"); |
| 206 return 1; | 207 return 1; |
| 207 } | 208 } |
| 208 } | 209 } |
| 210 |
| 209 if (!FLAGS_whiteDiffDir.isEmpty()) { | 211 if (!FLAGS_whiteDiffDir.isEmpty()) { |
| 210 if (1 != FLAGS_whiteDiffDir.count()) { | 212 if (1 != FLAGS_whiteDiffDir.count()) { |
| 211 SkDebugf("whiteDiffDir flag expects one argument: <directory>\n"); | 213 SkDebugf("whiteDiffDir flag expects one argument: <directory>\n"); |
| 212 return 1; | 214 return 1; |
| 213 } | 215 } |
| 214 } | 216 } |
| 215 | 217 |
| 216 SkDiffContext ctx; | 218 SkDiffContext ctx; |
| 217 ctx.setDiffers(chosenDiffers); | 219 ctx.setDiffers(chosenDiffers); |
| 220 ctx.setLongNames(FLAGS_longnames); |
| 218 | 221 |
| 219 if (!FLAGS_alphaDir.isEmpty()) { | 222 if (!FLAGS_alphaDir.isEmpty()) { |
| 220 ctx.setAlphaMaskDir(SkString(FLAGS_alphaDir[0])); | 223 ctx.setAlphaMaskDir(SkString(FLAGS_alphaDir[0])); |
| 221 } | 224 } |
| 222 if (!FLAGS_rgbDiffDir.isEmpty()) { | 225 if (!FLAGS_rgbDiffDir.isEmpty()) { |
| 223 ctx.setRgbDiffDir(SkString(FLAGS_rgbDiffDir[0])); | 226 ctx.setRgbDiffDir(SkString(FLAGS_rgbDiffDir[0])); |
| 224 } | 227 } |
| 225 if (!FLAGS_whiteDiffDir.isEmpty()) { | 228 if (!FLAGS_whiteDiffDir.isEmpty()) { |
| 226 ctx.setWhiteDiffDir(SkString(FLAGS_whiteDiffDir[0])); | 229 ctx.setWhiteDiffDir(SkString(FLAGS_whiteDiffDir[0])); |
| 227 } | 230 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 252 } | 255 } |
| 253 | 256 |
| 254 return 0; | 257 return 0; |
| 255 } | 258 } |
| 256 | 259 |
| 257 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 260 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 258 int main(int argc, char * argv[]) { | 261 int main(int argc, char * argv[]) { |
| 259 return tool_main(argc, (char**) argv); | 262 return tool_main(argc, (char**) argv); |
| 260 } | 263 } |
| 261 #endif | 264 #endif |
| OLD | NEW |