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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
12 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
| 14 #include "SkPictureRecorder.h" |
14 #include "SkRecordDraw.h" | 15 #include "SkRecordDraw.h" |
15 #include "SkRecordOpts.h" | 16 #include "SkRecordOpts.h" |
16 #include "SkRecorder.h" | 17 #include "SkRecorder.h" |
17 #include "SkStream.h" | 18 #include "SkStream.h" |
18 #include "SkString.h" | 19 #include "SkString.h" |
19 | 20 |
20 __SK_FORCE_IMAGE_DECODER_LINKING; | 21 __SK_FORCE_IMAGE_DECODER_LINKING; |
21 | 22 |
22 DEFINE_string2(skps, r, "skps", "Directory containing SKPs to read and re-record
."); | 23 DEFINE_string2(skps, r, "skps", "Directory containing SKPs to read and re-record
."); |
23 DEFINE_int32(loops, 10, "Number of times to play back each SKP."); | 24 DEFINE_int32(loops, 10, "Number of times to play back each SKP."); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 continue; | 95 continue; |
95 } | 96 } |
96 | 97 |
97 if (src->width() * src->height() > kMaxArea) { | 98 if (src->width() * src->height() > kMaxArea) { |
98 SkDebugf("%s (%dx%d) is larger than hardcoded scratch bitmap (%dpx).
\n", | 99 SkDebugf("%s (%dx%d) is larger than hardcoded scratch bitmap (%dpx).
\n", |
99 path.c_str(), src->width(), src->height(), kMaxArea); | 100 path.c_str(), src->width(), src->height(), kMaxArea); |
100 failed = true; | 101 failed = true; |
101 continue; | 102 continue; |
102 } | 103 } |
103 | 104 |
104 bench(scratch.get(), *src, filename.c_str()); | 105 // Rerecord into a picture using a tile grid. |
| 106 SkTileGridFactory::TileGridInfo info; |
| 107 info.fTileInterval.set(FLAGS_tile, FLAGS_tile); |
| 108 info.fMargin.setEmpty(); |
| 109 info.fOffset.setZero(); |
| 110 SkTileGridFactory factory(info); |
| 111 |
| 112 SkPictureRecorder recorder; |
| 113 SkCanvas* canvas = recorder.beginRecording(src->width(), src->height(), |
| 114 &factory, |
| 115 SkPicture::kUsePathBoundsForC
lip_RecordingFlag); |
| 116 src->draw(canvas); |
| 117 SkAutoTUnref<SkPicture> replay(recorder.endRecording()); |
| 118 |
| 119 bench(scratch.get(), *replay, filename.c_str()); |
105 } | 120 } |
106 return failed ? 1 : 0; | 121 return failed ? 1 : 0; |
107 } | 122 } |
108 | 123 |
109 #if !defined SK_BUILD_FOR_IOS | 124 #if !defined SK_BUILD_FOR_IOS |
110 int main(int argc, char * const argv[]) { | 125 int main(int argc, char * const argv[]) { |
111 return tool_main(argc, (char**) argv); | 126 return tool_main(argc, (char**) argv); |
112 } | 127 } |
113 #endif | 128 #endif |
OLD | NEW |