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

Side by Side Diff: tools/render_pictures_main.cpp

Issue 197123003: Proposed SkCanvas API for preLoading textures to VRAM v2.0 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: address code review comments Created 6 years, 9 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 | Annotate | Revision Log
« src/core/SkPicture.cpp ('K') | « tools/PictureRenderer.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 25 matching lines...) Expand all
36 "TODO(epoger): Currently, this only works if --writePath is also s pecified."); 36 "TODO(epoger): Currently, this only works if --writePath is also s pecified.");
37 DEFINE_string2(writePath, w, "", "Directory to write the rendered images."); 37 DEFINE_string2(writePath, w, "", "Directory to write the rendered images.");
38 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima ge to a " 38 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima ge to a "
39 "file, instead of an image for each tile."); 39 "file, instead of an image for each tile.");
40 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p ixels as " 40 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p ixels as "
41 "the picture rendered in simple mode. When used in conjunction with --bbh, results " 41 "the picture rendered in simple mode. When used in conjunction with --bbh, results "
42 "are validated against the picture rendered in the same mode, but wi thout the bbh."); 42 "are validated against the picture rendered in the same mode, but wi thout the bbh.");
43 43
44 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi ng the picture."); 44 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi ng the picture.");
45 45
46 DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing b efore rendering.");
47
46 static void make_output_filepath(SkString* path, const SkString& dir, 48 static void make_output_filepath(SkString* path, const SkString& dir,
47 const SkString& name) { 49 const SkString& name) {
48 sk_tools::make_filepath(path, dir, name); 50 sk_tools::make_filepath(path, dir, name);
49 // Remove ".skp" 51 // Remove ".skp"
50 path->remove(path->size() - 4, 4); 52 path->remove(path->size() - 4, 4);
51 } 53 }
52 54
53 //////////////////////////////////////////////////////////////////////////////// //////////////////// 55 //////////////////////////////////////////////////////////////////////////////// ////////////////////
54 56
55 /** 57 /**
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 for (int i = 0; i < FLAGS_clone; ++i) { 182 for (int i = 0; i < FLAGS_clone; ++i) {
181 SkPicture* clone = picture->clone(); 183 SkPicture* clone = picture->clone();
182 SkDELETE(picture); 184 SkDELETE(picture);
183 picture = clone; 185 picture = clone;
184 } 186 }
185 187
186 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), 188 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(),
187 inputPath.c_str()); 189 inputPath.c_str());
188 190
189 renderer.init(picture); 191 renderer.init(picture);
192
193 if (FLAGS_preprocess) {
194 if (NULL != renderer.getCanvas()) {
195 renderer.getCanvas()->EXPERIMENTAL_optimize(picture);
196 }
197 }
198
190 renderer.setup(); 199 renderer.setup();
191 200
192 SkString* outputPath = NULL; 201 SkString* outputPath = NULL;
193 if (NULL != outputDir && outputDir->size() > 0 && !FLAGS_writeEncodedImages) { 202 if (NULL != outputDir && outputDir->size() > 0 && !FLAGS_writeEncodedImages) {
194 outputPath = SkNEW(SkString); 203 outputPath = SkNEW(SkString);
195 make_output_filepath(outputPath, *outputDir, inputFilename); 204 make_output_filepath(outputPath, *outputDir, inputFilename);
196 } 205 }
197 206
198 bool success = renderer.render(outputPath, out); 207 bool success = renderer.render(outputPath, out);
199 if (outputPath) { 208 if (outputPath) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); 496 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]);
488 } 497 }
489 return 0; 498 return 0;
490 } 499 }
491 500
492 #if !defined SK_BUILD_FOR_IOS 501 #if !defined SK_BUILD_FOR_IOS
493 int main(int argc, char * const argv[]) { 502 int main(int argc, char * const argv[]) {
494 return tool_main(argc, (char**) argv); 503 return tool_main(argc, (char**) argv);
495 } 504 }
496 #endif 505 #endif
OLDNEW
« src/core/SkPicture.cpp ('K') | « tools/PictureRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698