OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "LazyDecodeBitmap.h" | 8 #include "LazyDecodeBitmap.h" |
9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 DEFINE_string(imageBaseGSUrl, "", "The Google Storage image base URL the images
are stored in."); | 33 DEFINE_string(imageBaseGSUrl, "", "The Google Storage image base URL the images
are stored in."); |
34 DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo
nents that differ " | 34 DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo
nents that differ " |
35 "by more than this amount are considered errors, though all diffs a
re reported. " | 35 "by more than this amount are considered errors, though all diffs a
re reported. " |
36 "Requires --validate."); | 36 "Requires --validate."); |
37 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " | 37 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " |
38 "pixel mismatches into this directory."); | 38 "pixel mismatches into this directory."); |
39 #if GR_GPU_STATS | 39 #if GR_GPU_STATS |
40 DEFINE_bool(gpuStats, false, "Only meaningful with gpu configurations. " | 40 DEFINE_bool(gpuStats, false, "Only meaningful with gpu configurations. " |
41 "Report some GPU call statistics."); | 41 "Report some GPU call statistics."); |
42 #endif | 42 #endif |
43 DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing b
efore rendering."); | 43 DEFINE_bool(mpd, false, "If true, use MultiPictureDraw for rendering."); |
44 DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations fro
m."); | 44 DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations fro
m."); |
45 DECLARE_string(readPath); | 45 DECLARE_string(readPath); |
46 DEFINE_bool(writeChecksumBasedFilenames, false, | 46 DEFINE_bool(writeChecksumBasedFilenames, false, |
47 "When writing out images, use checksum-based filenames."); | 47 "When writing out images, use checksum-based filenames."); |
48 DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded ima
ge, write it to a " | 48 DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded ima
ge, write it to a " |
49 "file rather than decoding it. Requires writePath to be set. Skips d
rawing the full " | 49 "file rather than decoding it. Requires writePath to be set. Skips d
rawing the full " |
50 "skp to a file. Not compatible with deferImageDecoding."); | 50 "skp to a file. Not compatible with deferImageDecoding."); |
51 DEFINE_string(writeJsonSummaryPath, "", "File to write a JSON summary of image r
esults to."); | 51 DEFINE_string(writeJsonSummaryPath, "", "File to write a JSON summary of image r
esults to."); |
52 DEFINE_string2(writePath, w, "", "Directory to write the rendered images into.")
; | 52 DEFINE_string2(writePath, w, "", "Directory to write the rendered images into.")
; |
53 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima
ge to a " | 53 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima
ge to a " |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 SkDebugf("deserializing... %s\n", inputPath.c_str()); | 178 SkDebugf("deserializing... %s\n", inputPath.c_str()); |
179 | 179 |
180 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); | 180 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr
oc)); |
181 | 181 |
182 if (NULL == picture) { | 182 if (NULL == picture) { |
183 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 183 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
184 return false; | 184 return false; |
185 } | 185 } |
186 | 186 |
187 if (FLAGS_preprocess) { | |
188 // Because the GPU preprocessing step relies on the in-memory picture | |
189 // statistics we need to rerecord the picture here | |
190 SkPictureRecorder recorder; | |
191 picture->playback(recorder.beginRecording(picture->cullRect().width(), | |
192 picture->cullRect().height(), | |
193 NULL, 0)); | |
194 picture.reset(recorder.endRecording()); | |
195 } | |
196 | |
197 while (FLAGS_bench_record) { | 187 while (FLAGS_bench_record) { |
198 SkPictureRecorder recorder; | 188 SkPictureRecorder recorder; |
199 picture->playback(recorder.beginRecording(picture->cullRect().width(), | 189 picture->playback(recorder.beginRecording(picture->cullRect().width(), |
200 picture->cullRect().height(), | 190 picture->cullRect().height(), |
201 NULL, 0)); | 191 NULL, 0)); |
202 SkAutoTUnref<SkPicture> other(recorder.endRecording()); | 192 SkAutoTUnref<SkPicture> other(recorder.endRecording()); |
203 } | 193 } |
204 | 194 |
205 SkDebugf("drawing... [%f %f %f %f] %s\n", | 195 SkDebugf("drawing... [%f %f %f %f] %s\n", |
206 picture->cullRect().fLeft, picture->cullRect().fTop, | 196 picture->cullRect().fLeft, picture->cullRect().fTop, |
207 picture->cullRect().fRight, picture->cullRect().fBottom, | 197 picture->cullRect().fRight, picture->cullRect().fBottom, |
208 inputPath.c_str()); | 198 inputPath.c_str()); |
209 | 199 |
210 renderer.init(picture, &writePathString, &mismatchPathString, &inputFilename
, | 200 renderer.init(picture, &writePathString, &mismatchPathString, &inputFilename
, |
211 FLAGS_writeChecksumBasedFilenames); | 201 FLAGS_writeChecksumBasedFilenames, FLAGS_mpd); |
212 | |
213 if (FLAGS_preprocess) { | |
214 if (renderer.getCanvas()) { | |
215 renderer.getCanvas()->EXPERIMENTAL_optimize(renderer.getPicture()); | |
216 } | |
217 } | |
218 | 202 |
219 renderer.setup(); | 203 renderer.setup(); |
220 renderer.enableWrites(); | 204 renderer.enableWrites(); |
221 | 205 |
222 bool success = renderer.render(out); | 206 bool success = renderer.render(out); |
223 if (!success) { | 207 if (!success) { |
224 SkDebugf("Failed to render %s\n", inputFilename.c_str()); | 208 SkDebugf("Failed to render %s\n", inputFilename.c_str()); |
225 } | 209 } |
226 | 210 |
227 renderer.end(); | 211 renderer.end(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); | 506 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); |
523 } | 507 } |
524 return 0; | 508 return 0; |
525 } | 509 } |
526 | 510 |
527 #if !defined SK_BUILD_FOR_IOS | 511 #if !defined SK_BUILD_FOR_IOS |
528 int main(int argc, char * const argv[]) { | 512 int main(int argc, char * const argv[]) { |
529 return tool_main(argc, (char**) argv); | 513 return tool_main(argc, (char**) argv); |
530 } | 514 } |
531 #endif | 515 #endif |
OLD | NEW |