Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tools/render_pictures_main.cpp

Issue 639013003: Update old tools to allow MultiPictureDraw rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/bench_pictures_main.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « tools/bench_pictures_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698