| 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 21 matching lines...) Expand all Loading... |
| 32 DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded ima
ge, write it to a " | 32 DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded ima
ge, write it to a " |
| 33 "file rather than decoding it. Requires writePath to be set. Skips d
rawing the full " | 33 "file rather than decoding it. Requires writePath to be set. Skips d
rawing the full " |
| 34 "skp to a file. Not compatible with deferImageDecoding."); | 34 "skp to a file. Not compatible with deferImageDecoding."); |
| 35 DEFINE_string2(writePath, w, "", "Directory to write the rendered images."); | 35 DEFINE_string2(writePath, w, "", "Directory to write the rendered images."); |
| 36 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima
ge to a " | 36 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima
ge to a " |
| 37 "file, instead of an image for each tile."); | 37 "file, instead of an image for each tile."); |
| 38 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p
ixels as " | 38 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p
ixels as " |
| 39 "the picture rendered in simple mode. When used in conjunction with
--bbh, results " | 39 "the picture rendered in simple mode. When used in conjunction with
--bbh, results " |
| 40 "are validated against the picture rendered in the same mode, but wi
thout the bbh."); | 40 "are validated against the picture rendered in the same mode, but wi
thout the bbh."); |
| 41 | 41 |
| 42 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi
ng the picture."); |
| 43 |
| 42 static void make_output_filepath(SkString* path, const SkString& dir, | 44 static void make_output_filepath(SkString* path, const SkString& dir, |
| 43 const SkString& name) { | 45 const SkString& name) { |
| 44 sk_tools::make_filepath(path, dir, name); | 46 sk_tools::make_filepath(path, dir, name); |
| 45 // Remove ".skp" | 47 // Remove ".skp" |
| 46 path->remove(path->size() - 4, 4); | 48 path->remove(path->size() - 4, 4); |
| 47 } | 49 } |
| 48 | 50 |
| 49 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 51 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
| 50 | 52 |
| 51 /** | 53 /** |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 158 |
| 157 SkDebugf("deserializing... %s\n", inputPath.c_str()); | 159 SkDebugf("deserializing... %s\n", inputPath.c_str()); |
| 158 | 160 |
| 159 SkPicture* picture = SkPicture::CreateFromStream(&inputStream, proc); | 161 SkPicture* picture = SkPicture::CreateFromStream(&inputStream, proc); |
| 160 | 162 |
| 161 if (NULL == picture) { | 163 if (NULL == picture) { |
| 162 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 164 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
| 163 return false; | 165 return false; |
| 164 } | 166 } |
| 165 | 167 |
| 168 while (FLAGS_bench_record) { |
| 169 const int kRecordFlags = 0; |
| 170 SkPicture other; |
| 171 picture->draw(other.beginRecording(picture->width(), picture->height(),
kRecordFlags)); |
| 172 other.endRecording(); |
| 173 } |
| 174 |
| 166 for (int i = 0; i < FLAGS_clone; ++i) { | 175 for (int i = 0; i < FLAGS_clone; ++i) { |
| 167 SkPicture* clone = picture->clone(); | 176 SkPicture* clone = picture->clone(); |
| 168 SkDELETE(picture); | 177 SkDELETE(picture); |
| 169 picture = clone; | 178 picture = clone; |
| 170 } | 179 } |
| 171 | 180 |
| 172 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), | 181 SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(), |
| 173 inputPath.c_str()); | 182 inputPath.c_str()); |
| 174 | 183 |
| 175 renderer.init(picture); | 184 renderer.init(picture); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 #endif | 446 #endif |
| 438 #endif | 447 #endif |
| 439 return 0; | 448 return 0; |
| 440 } | 449 } |
| 441 | 450 |
| 442 #if !defined SK_BUILD_FOR_IOS | 451 #if !defined SK_BUILD_FOR_IOS |
| 443 int main(int argc, char * const argv[]) { | 452 int main(int argc, char * const argv[]) { |
| 444 return tool_main(argc, (char**) argv); | 453 return tool_main(argc, (char**) argv); |
| 445 } | 454 } |
| 446 #endif | 455 #endif |
| OLD | NEW |