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 #if SK_SUPPORT_OPENCL | 8 #if SK_SUPPORT_OPENCL |
9 | 9 |
10 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr | 10 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "skpdiff_util.h" | 30 #include "skpdiff_util.h" |
31 | 31 |
32 #include "SkForceLinking.h" | 32 #include "SkForceLinking.h" |
33 __SK_FORCE_IMAGE_DECODER_LINKING; | 33 __SK_FORCE_IMAGE_DECODER_LINKING; |
34 | 34 |
35 // Command line argument definitions go here | 35 // Command line argument definitions go here |
36 DEFINE_bool2(list, l, false, "List out available differs"); | 36 DEFINE_bool2(list, l, false, "List out available differs"); |
37 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
y default"); | 37 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
y default"); |
38 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names
: <baseline folder> <test folder>"); | 38 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names
: <baseline folder> <test folder>"); |
39 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
<test>"); | 39 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
<test>"); |
40 DEFINE_string2(output, o, "", "Writes the output of these diffs to output: <outp
ut>"); | 40 DEFINE_string2(output, o, "", "Writes a JSON summary of these diffs to file: <fi
lepath>"); |
41 DEFINE_string(alphaDir, "", "Writes the alpha mask of these diffs to output: <ou
tput>"); | 41 DEFINE_string(alphaDir, "", "If the differ can generate an alpha mask, write it
into directory: <dirpath>"); |
| 42 DEFINE_string(rgbDiffDir, "", "If the differ can generate an image showing the R
GB diff at each pixel, write it into directory: <dirpath>"); |
| 43 DEFINE_string(whiteDiffDir, "", "If the differ can generate an image showing eve
ry changed pixel in white, write it into directory: <dirpath>"); |
42 DEFINE_bool(jsonp, true, "Output JSON with padding"); | 44 DEFINE_bool(jsonp, true, "Output JSON with padding"); |
43 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file"); | 45 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file: <filepat
h>"); |
44 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP
Us available]"); | 46 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP
Us available]"); |
45 | 47 |
46 #if SK_SUPPORT_OPENCL | 48 #if SK_SUPPORT_OPENCL |
47 /// A callback for any OpenCL errors | 49 /// A callback for any OpenCL errors |
48 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI
nfoSize, ::size_t cb, void* userData) { | 50 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI
nfoSize, ::size_t cb, void* userData) { |
49 SkDebugf("OpenCL error notify: %s\n", errorInfo); | 51 SkDebugf("OpenCL error notify: %s\n", errorInfo); |
50 exit(1); | 52 exit(1); |
51 } | 53 } |
52 | 54 |
53 /// Creates a device and context with OpenCL | 55 /// Creates a device and context with OpenCL |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return 1; | 188 return 1; |
187 } | 189 } |
188 } | 190 } |
189 | 191 |
190 if (!FLAGS_alphaDir.isEmpty()) { | 192 if (!FLAGS_alphaDir.isEmpty()) { |
191 if (1 != FLAGS_alphaDir.count()) { | 193 if (1 != FLAGS_alphaDir.count()) { |
192 SkDebugf("alphaDir flag expects one argument: <directory>\n"); | 194 SkDebugf("alphaDir flag expects one argument: <directory>\n"); |
193 return 1; | 195 return 1; |
194 } | 196 } |
195 } | 197 } |
| 198 if (!FLAGS_rgbDiffDir.isEmpty()) { |
| 199 if (1 != FLAGS_rgbDiffDir.count()) { |
| 200 SkDebugf("rgbDiffDir flag expects one argument: <directory>\n"); |
| 201 return 1; |
| 202 } |
| 203 } |
| 204 if (!FLAGS_whiteDiffDir.isEmpty()) { |
| 205 if (1 != FLAGS_whiteDiffDir.count()) { |
| 206 SkDebugf("whiteDiffDir flag expects one argument: <directory>\n"); |
| 207 return 1; |
| 208 } |
| 209 } |
196 | 210 |
197 SkDiffContext ctx; | 211 SkDiffContext ctx; |
198 ctx.setDiffers(chosenDiffers); | 212 ctx.setDiffers(chosenDiffers); |
199 | 213 |
200 if (!FLAGS_alphaDir.isEmpty()) { | 214 if (!FLAGS_alphaDir.isEmpty()) { |
201 ctx.setDifferenceDir(SkString(FLAGS_alphaDir[0])); | 215 ctx.setAlphaMaskDir(SkString(FLAGS_alphaDir[0])); |
| 216 } |
| 217 if (!FLAGS_rgbDiffDir.isEmpty()) { |
| 218 ctx.setRgbDiffDir(SkString(FLAGS_rgbDiffDir[0])); |
| 219 } |
| 220 if (!FLAGS_whiteDiffDir.isEmpty()) { |
| 221 ctx.setWhiteDiffDir(SkString(FLAGS_whiteDiffDir[0])); |
202 } | 222 } |
203 | 223 |
204 if (FLAGS_threads >= 0) { | 224 if (FLAGS_threads >= 0) { |
205 ctx.setThreadCount(FLAGS_threads); | 225 ctx.setThreadCount(FLAGS_threads); |
206 } | 226 } |
207 | 227 |
208 // Perform a folder diff if one is requested | 228 // Perform a folder diff if one is requested |
209 if (!FLAGS_folders.isEmpty()) { | 229 if (!FLAGS_folders.isEmpty()) { |
210 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); | 230 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); |
211 } | 231 } |
(...skipping 15 matching lines...) Expand all Loading... |
227 } | 247 } |
228 | 248 |
229 return 0; | 249 return 0; |
230 } | 250 } |
231 | 251 |
232 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 252 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
233 int main(int argc, char * argv[]) { | 253 int main(int argc, char * argv[]) { |
234 return tool_main(argc, (char**) argv); | 254 return tool_main(argc, (char**) argv); |
235 } | 255 } |
236 #endif | 256 #endif |
OLD | NEW |