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 26 matching lines...) Expand all Loading... |
37 "See https://code.google.com/p/skia/issues/detail?id=2043 ."); | 37 "See https://code.google.com/p/skia/issues/detail?id=2043 ."); |
38 DEFINE_string2(writePath, w, "", "Directory to write the rendered images."); | 38 DEFINE_string2(writePath, w, "", "Directory to write the rendered images."); |
39 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima
ge to a " | 39 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima
ge to a " |
40 "file, instead of an image for each tile."); | 40 "file, instead of an image for each tile."); |
41 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p
ixels as " | 41 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p
ixels as " |
42 "the picture rendered in simple mode. When used in conjunction with
--bbh, results " | 42 "the picture rendered in simple mode. When used in conjunction with
--bbh, results " |
43 "are validated against the picture rendered in the same mode, but wi
thout the bbh."); | 43 "are validated against the picture rendered in the same mode, but wi
thout the bbh."); |
44 | 44 |
45 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi
ng the picture."); | 45 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi
ng the picture."); |
46 | 46 |
| 47 DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing b
efore rendering."); |
| 48 |
47 static void make_output_filepath(SkString* path, const SkString& dir, | 49 static void make_output_filepath(SkString* path, const SkString& dir, |
48 const SkString& name) { | 50 const SkString& name) { |
49 sk_tools::make_filepath(path, dir, name); | 51 sk_tools::make_filepath(path, dir, name); |
50 // Remove ".skp" | 52 // Remove ".skp" |
51 path->remove(path->size() - 4, 4); | 53 path->remove(path->size() - 4, 4); |
52 } | 54 } |
53 | 55 |
54 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 56 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
55 | 57 |
56 /** | 58 /** |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 for (int i = 0; i < FLAGS_clone; ++i) { | 183 for (int i = 0; i < FLAGS_clone; ++i) { |
182 SkPicture* clone = picture->clone(); | 184 SkPicture* clone = picture->clone(); |
183 SkDELETE(picture); | 185 SkDELETE(picture); |
184 picture = clone; | 186 picture = clone; |
185 } | 187 } |
186 | 188 |
187 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), | 189 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), |
188 inputPath.c_str()); | 190 inputPath.c_str()); |
189 | 191 |
190 renderer.init(picture); | 192 renderer.init(picture); |
| 193 |
| 194 if (FLAGS_preprocess) { |
| 195 if (NULL != renderer.getCanvas()) { |
| 196 renderer.getCanvas()->EXPERIMENTAL_optimize(picture); |
| 197 } |
| 198 } |
| 199 |
191 renderer.setup(); | 200 renderer.setup(); |
192 | 201 |
193 SkString* outputPath = NULL; | 202 SkString* outputPath = NULL; |
194 if (NULL != outputDir && outputDir->size() > 0 && !FLAGS_writeEncodedImages)
{ | 203 if (NULL != outputDir && outputDir->size() > 0 && !FLAGS_writeEncodedImages)
{ |
195 outputPath = SkNEW(SkString); | 204 outputPath = SkNEW(SkString); |
196 make_output_filepath(outputPath, *outputDir, inputFilename); | 205 make_output_filepath(outputPath, *outputDir, inputFilename); |
197 } | 206 } |
198 | 207 |
199 bool success = renderer.render(outputPath, out); | 208 bool success = renderer.render(outputPath, out); |
200 if (outputPath) { | 209 if (outputPath) { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); | 497 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); |
489 } | 498 } |
490 return 0; | 499 return 0; |
491 } | 500 } |
492 | 501 |
493 #if !defined SK_BUILD_FOR_IOS | 502 #if !defined SK_BUILD_FOR_IOS |
494 int main(int argc, char * const argv[]) { | 503 int main(int argc, char * const argv[]) { |
495 return tool_main(argc, (char**) argv); | 504 return tool_main(argc, (char**) argv); |
496 } | 505 } |
497 #endif | 506 #endif |
OLD | NEW |