| 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 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr | 9 #define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr |
| 10 #define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string | 10 #define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "SkForceLinking.h" | 25 #include "SkForceLinking.h" |
| 26 __SK_FORCE_IMAGE_DECODER_LINKING; | 26 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 27 | 27 |
| 28 // Command line argument definitions go here | 28 // Command line argument definitions go here |
| 29 DEFINE_bool2(list, l, false, "List out available differs"); | 29 DEFINE_bool2(list, l, false, "List out available differs"); |
| 30 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
y default"); | 30 DEFINE_string2(differs, d, "", "The names of the differs to use or all of them b
y default"); |
| 31 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names
: <baseline folder> <test folder>"); | 31 DEFINE_string2(folders, f, "", "Compare two folders with identical subfile names
: <baseline folder> <test folder>"); |
| 32 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
<test>"); | 32 DEFINE_string2(patterns, p, "", "Use two patterns to compare images: <baseline>
<test>"); |
| 33 DEFINE_string2(output, o, "skpdiff_output.json", "Writes the output of these dif
fs to output: <output>"); | 33 DEFINE_string2(output, o, "skpdiff_output.json", "Writes the output of these dif
fs to output: <output>"); |
| 34 DEFINE_bool(jsonp, true, "Output JSON with padding"); | 34 DEFINE_bool(jsonp, true, "Output JSON with padding"); |
| 35 DEFINE_string(csv, "", "Writes the output of these diffs to a csv file"); | |
| 36 | 35 |
| 37 #if SK_SUPPORT_OPENCL | 36 #if SK_SUPPORT_OPENCL |
| 38 /// A callback for any OpenCL errors | 37 /// A callback for any OpenCL errors |
| 39 CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize
, ::size_t cb, void* userData) { | 38 CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize
, ::size_t cb, void* userData) { |
| 40 SkDebugf("OpenCL error notify: %s\n", errorInfo); | 39 SkDebugf("OpenCL error notify: %s\n", errorInfo); |
| 41 exit(1); | 40 exit(1); |
| 42 } | 41 } |
| 43 | 42 |
| 44 /// Creates a device and context with OpenCL | 43 /// Creates a device and context with OpenCL |
| 45 static bool init_device_and_context(cl::Device* device, cl::Context* context) { | 44 static bool init_device_and_context(cl::Device* device, cl::Context* context) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 162 } |
| 164 } | 163 } |
| 165 | 164 |
| 166 if (!FLAGS_patterns.isEmpty()) { | 165 if (!FLAGS_patterns.isEmpty()) { |
| 167 if (2 != FLAGS_patterns.count()) { | 166 if (2 != FLAGS_patterns.count()) { |
| 168 SkDebugf("Patterns flag expects two arguments: <baseline pattern> <t
est pattern>\n"); | 167 SkDebugf("Patterns flag expects two arguments: <baseline pattern> <t
est pattern>\n"); |
| 169 return 1; | 168 return 1; |
| 170 } | 169 } |
| 171 } | 170 } |
| 172 | 171 |
| 173 if (!FLAGS_csv.isEmpty()) { | |
| 174 if (1 != FLAGS_csv.count()) { | |
| 175 SkDebugf("csv flag expects one argument: <csv file>\n"); | |
| 176 return 1; | |
| 177 } | |
| 178 } | |
| 179 | |
| 180 SkDiffContext ctx; | 172 SkDiffContext ctx; |
| 181 ctx.setDiffers(chosenDiffers); | 173 ctx.setDiffers(chosenDiffers); |
| 182 | 174 |
| 183 // Perform a folder diff if one is requested | 175 // Perform a folder diff if one is requested |
| 184 if (!FLAGS_folders.isEmpty()) { | 176 if (!FLAGS_folders.isEmpty()) { |
| 185 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); | 177 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); |
| 186 } | 178 } |
| 187 | 179 |
| 188 // Perform a pattern diff if one is requested | 180 // Perform a pattern diff if one is requested |
| 189 if (!FLAGS_patterns.isEmpty()) { | 181 if (!FLAGS_patterns.isEmpty()) { |
| 190 ctx.diffPatterns(FLAGS_patterns[0], FLAGS_patterns[1]); | 182 ctx.diffPatterns(FLAGS_patterns[0], FLAGS_patterns[1]); |
| 191 } | 183 } |
| 192 | 184 |
| 193 // Output to the file specified | 185 // Output to the file specified |
| 194 if (!FLAGS_output.isEmpty()) { | 186 if (!FLAGS_output.isEmpty()) { |
| 195 SkFILEWStream outputStream(FLAGS_output[0]); | 187 SkFILEWStream outputStream(FLAGS_output[0]); |
| 196 ctx.outputRecords(outputStream, FLAGS_jsonp); | 188 ctx.outputRecords(outputStream, FLAGS_jsonp); |
| 197 } | 189 } |
| 198 | 190 |
| 199 return 0; | 191 return 0; |
| 200 } | 192 } |
| OLD | NEW |