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 20 matching lines...) Expand all Loading... |
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 the output of these diffs to output: <outp
ut>"); |
| 41 DEFINE_string(alphaDir, "", "Writes the alpha mask of these diffs to output: <ou
tput>"); |
41 DEFINE_bool(jsonp, true, "Output JSON with padding"); | 42 DEFINE_bool(jsonp, true, "Output JSON with padding"); |
42 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file"); | 43 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file"); |
43 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP
Us available]"); | 44 DEFINE_int32(threads, -1, "run N threads in parallel [default is derived from CP
Us available]"); |
44 | 45 |
45 #if SK_SUPPORT_OPENCL | 46 #if SK_SUPPORT_OPENCL |
46 /// A callback for any OpenCL errors | 47 /// A callback for any OpenCL errors |
47 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI
nfoSize, ::size_t cb, void* userData) { | 48 static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateI
nfoSize, ::size_t cb, void* userData) { |
48 SkDebugf("OpenCL error notify: %s\n", errorInfo); | 49 SkDebugf("OpenCL error notify: %s\n", errorInfo); |
49 exit(1); | 50 exit(1); |
50 } | 51 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 180 } |
180 } | 181 } |
181 | 182 |
182 if (!FLAGS_csv.isEmpty()) { | 183 if (!FLAGS_csv.isEmpty()) { |
183 if (1 != FLAGS_csv.count()) { | 184 if (1 != FLAGS_csv.count()) { |
184 SkDebugf("csv flag expects one argument: <csv file>\n"); | 185 SkDebugf("csv flag expects one argument: <csv file>\n"); |
185 return 1; | 186 return 1; |
186 } | 187 } |
187 } | 188 } |
188 | 189 |
| 190 if (!FLAGS_alphaDir.isEmpty()) { |
| 191 if (1 != FLAGS_alphaDir.count()) { |
| 192 SkDebugf("alphaDir flag expects one argument: <directory>\n"); |
| 193 return 1; |
| 194 } |
| 195 } |
| 196 |
189 SkDiffContext ctx; | 197 SkDiffContext ctx; |
190 ctx.setDiffers(chosenDiffers); | 198 ctx.setDiffers(chosenDiffers); |
191 | 199 |
| 200 if (!FLAGS_alphaDir.isEmpty()) { |
| 201 ctx.setDifferenceDir(SkString(FLAGS_alphaDir[0])); |
| 202 } |
| 203 |
192 if (FLAGS_threads >= 0) { | 204 if (FLAGS_threads >= 0) { |
193 ctx.setThreadCount(FLAGS_threads); | 205 ctx.setThreadCount(FLAGS_threads); |
194 } | 206 } |
195 | 207 |
196 // Perform a folder diff if one is requested | 208 // Perform a folder diff if one is requested |
197 if (!FLAGS_folders.isEmpty()) { | 209 if (!FLAGS_folders.isEmpty()) { |
198 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); | 210 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); |
199 } | 211 } |
200 | 212 |
201 // Perform a pattern diff if one is requested | 213 // Perform a pattern diff if one is requested |
(...skipping 13 matching lines...) Expand all Loading... |
215 } | 227 } |
216 | 228 |
217 return 0; | 229 return 0; |
218 } | 230 } |
219 | 231 |
220 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 232 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
221 int main(int argc, char * argv[]) { | 233 int main(int argc, char * argv[]) { |
222 return tool_main(argc, (char**) argv); | 234 return tool_main(argc, (char**) argv); |
223 } | 235 } |
224 #endif | 236 #endif |
OLD | NEW |