| 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"); |
| 35 | 36 |
| 36 #if SK_SUPPORT_OPENCL | 37 #if SK_SUPPORT_OPENCL |
| 37 /// A callback for any OpenCL errors | 38 /// A callback for any OpenCL errors |
| 38 CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize
, ::size_t cb, void* userData) { | 39 CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize
, ::size_t cb, void* userData) { |
| 39 SkDebugf("OpenCL error notify: %s\n", errorInfo); | 40 SkDebugf("OpenCL error notify: %s\n", errorInfo); |
| 40 exit(1); | 41 exit(1); |
| 41 } | 42 } |
| 42 | 43 |
| 43 /// Creates a device and context with OpenCL | 44 /// Creates a device and context with OpenCL |
| 44 static bool init_device_and_context(cl::Device* device, cl::Context* context) { | 45 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... |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 | 165 |
| 165 if (!FLAGS_patterns.isEmpty()) { | 166 if (!FLAGS_patterns.isEmpty()) { |
| 166 if (2 != FLAGS_patterns.count()) { | 167 if (2 != FLAGS_patterns.count()) { |
| 167 SkDebugf("Patterns flag expects two arguments: <baseline pattern> <t
est pattern>\n"); | 168 SkDebugf("Patterns flag expects two arguments: <baseline pattern> <t
est pattern>\n"); |
| 168 return 1; | 169 return 1; |
| 169 } | 170 } |
| 170 } | 171 } |
| 171 | 172 |
| 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 |
| 172 SkDiffContext ctx; | 180 SkDiffContext ctx; |
| 173 ctx.setDiffers(chosenDiffers); | 181 ctx.setDiffers(chosenDiffers); |
| 174 | 182 |
| 175 // Perform a folder diff if one is requested | 183 // Perform a folder diff if one is requested |
| 176 if (!FLAGS_folders.isEmpty()) { | 184 if (!FLAGS_folders.isEmpty()) { |
| 177 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); | 185 ctx.diffDirectories(FLAGS_folders[0], FLAGS_folders[1]); |
| 178 } | 186 } |
| 179 | 187 |
| 180 // Perform a pattern diff if one is requested | 188 // Perform a pattern diff if one is requested |
| 181 if (!FLAGS_patterns.isEmpty()) { | 189 if (!FLAGS_patterns.isEmpty()) { |
| 182 ctx.diffPatterns(FLAGS_patterns[0], FLAGS_patterns[1]); | 190 ctx.diffPatterns(FLAGS_patterns[0], FLAGS_patterns[1]); |
| 183 } | 191 } |
| 184 | 192 |
| 185 // Output to the file specified | 193 // Output to the file specified |
| 186 if (!FLAGS_output.isEmpty()) { | 194 if (!FLAGS_output.isEmpty()) { |
| 187 SkFILEWStream outputStream(FLAGS_output[0]); | 195 SkFILEWStream outputStream(FLAGS_output[0]); |
| 188 ctx.outputRecords(outputStream, FLAGS_jsonp); | 196 ctx.outputRecords(outputStream, FLAGS_jsonp); |
| 189 } | 197 } |
| 190 | 198 |
| 199 if (!FLAGS_csv.isEmpty()) { |
| 200 SkFILEWStream outputStream(FLAGS_csv[0]); |
| 201 ctx.outputCsv(outputStream); |
| 202 } |
| 203 |
| 191 return 0; | 204 return 0; |
| 192 } | 205 } |
| OLD | NEW |