| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "DumpRecord.h" | 8 #include "DumpRecord.h" |
| 9 #include "LazyDecodeBitmap.h" | 9 #include "LazyDecodeBitmap.h" |
| 10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
| 11 #include "SkPicture.h" | 11 #include "SkPicture.h" |
| 12 #include "SkRecordOpts.h" | 12 #include "SkRecordOpts.h" |
| 13 #include "SkRecorder.h" | 13 #include "SkRecorder.h" |
| 14 #include "SkStream.h" | 14 #include "SkStream.h" |
| 15 #include <stdio.h> | 15 #include <stdio.h> |
| 16 | 16 |
| 17 DEFINE_string2(skps, r, "", ".SKPs to dump."); | 17 DEFINE_string2(skps, r, "", ".SKPs to dump."); |
| 18 DEFINE_string(match, "", "The usual filters on file names to dump."); | 18 DEFINE_string(match, "", "The usual filters on file names to dump."); |
| 19 DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping."); | 19 DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping."); |
| 20 DEFINE_bool(optimize2, false, "Run SkRecordOptimize2 before dumping."); |
| 20 DEFINE_int32(tile, 1000000000, "Simulated tile size."); | 21 DEFINE_int32(tile, 1000000000, "Simulated tile size."); |
| 21 DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else i
n first column."); | 22 DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else i
n first column."); |
| 22 | 23 |
| 23 static void dump(const char* name, int w, int h, const SkRecord& record) { | 24 static void dump(const char* name, int w, int h, const SkRecord& record) { |
| 24 SkBitmap bitmap; | 25 SkBitmap bitmap; |
| 25 bitmap.allocN32Pixels(w, h); | 26 bitmap.allocN32Pixels(w, h); |
| 26 SkCanvas canvas(bitmap); | 27 SkCanvas canvas(bitmap); |
| 27 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), | 28 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), |
| 28 SkIntToScalar(FLAGS_tile))); | 29 SkIntToScalar(FLAGS_tile))); |
| 29 | 30 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 56 const int w = SkScalarCeilToInt(src->cullRect().width()); | 57 const int w = SkScalarCeilToInt(src->cullRect().width()); |
| 57 const int h = SkScalarCeilToInt(src->cullRect().height()); | 58 const int h = SkScalarCeilToInt(src->cullRect().height()); |
| 58 | 59 |
| 59 SkRecord record; | 60 SkRecord record; |
| 60 SkRecorder canvas(&record, w, h); | 61 SkRecorder canvas(&record, w, h); |
| 61 src->playback(&canvas); | 62 src->playback(&canvas); |
| 62 | 63 |
| 63 if (FLAGS_optimize) { | 64 if (FLAGS_optimize) { |
| 64 SkRecordOptimize(&record); | 65 SkRecordOptimize(&record); |
| 65 } | 66 } |
| 67 if (FLAGS_optimize2) { |
| 68 SkRecordOptimize2(&record); |
| 69 } |
| 66 | 70 |
| 67 dump(FLAGS_skps[i], w, h, record); | 71 dump(FLAGS_skps[i], w, h, record); |
| 68 } | 72 } |
| 69 | 73 |
| 70 return 0; | 74 return 0; |
| 71 } | 75 } |
| 72 | 76 |
| 73 #if !defined SK_BUILD_FOR_IOS | 77 #if !defined SK_BUILD_FOR_IOS |
| 74 int main(int argc, char * const argv[]) { | 78 int main(int argc, char * const argv[]) { |
| 75 return tool_main(argc, (char**) argv); | 79 return tool_main(argc, (char**) argv); |
| 76 } | 80 } |
| 77 #endif | 81 #endif |
| OLD | NEW |