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 "SkCommandLineFlags.h" | 8 #include "SkCommandLineFlags.h" |
9 #include "SkForceLinking.h" | 9 #include "SkForceLinking.h" |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
11 #include "SkOSFile.h" | 11 #include "SkOSFile.h" |
12 #include "SkPicture.h" | 12 #include "SkPicture.h" |
13 #include "SkPictureRecorder.h" | 13 #include "SkPictureRecorder.h" |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 | 16 |
17 #include "LazyDecodeBitmap.h" | 17 #include "LazyDecodeBitmap.h" |
18 #include "Stats.h" | 18 #include "Stats.h" |
19 #include "Timer.h" | 19 #include "Timer.h" |
20 | 20 |
21 __SK_FORCE_IMAGE_DECODER_LINKING; | 21 __SK_FORCE_IMAGE_DECODER_LINKING; |
22 | 22 |
23 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
."); |
24 DEFINE_int32(samples, 10, "Number of times to re-record each SKP."); | 24 DEFINE_int32(samples, 10, "Number of times to re-record each SKP."); |
25 DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is
not set to tilegrid."); | 25 DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is
not set to tilegrid."); |
26 DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tileg
rid, quadtree"); | 26 DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tileg
rid"); |
27 DEFINE_bool(skr, false, "Record SKR instead of SKP."); | 27 DEFINE_bool(skr, false, "Record SKR instead of SKP."); |
28 DEFINE_string(match, "", "The usual filters on file names of SKPs to bench."); | 28 DEFINE_string(match, "", "The usual filters on file names of SKPs to bench."); |
29 DEFINE_string(timescale, "us", "Print times in ms, us, or ns"); | 29 DEFINE_string(timescale, "us", "Print times in ms, us, or ns"); |
30 DEFINE_double(overheadGoal, 0.0001, | 30 DEFINE_double(overheadGoal, 0.0001, |
31 "Try to make timer overhead at most this fraction of our sample me
asurements."); | 31 "Try to make timer overhead at most this fraction of our sample me
asurements."); |
32 DEFINE_int32(verbose, 0, "0: print min sample; " | 32 DEFINE_int32(verbose, 0, "0: print min sample; " |
33 "1: print min, mean, max and noise indication " | 33 "1: print min, mean, max and noise indication " |
34 "2: print all samples"); | 34 "2: print all samples"); |
35 | 35 |
36 static double timescale() { | 36 static double timescale() { |
(...skipping 10 matching lines...) Expand all Loading... |
47 if (FLAGS_bbh.contains("rtree")) { | 47 if (FLAGS_bbh.contains("rtree")) { |
48 return SkNEW(SkRTreeFactory); | 48 return SkNEW(SkRTreeFactory); |
49 } | 49 } |
50 if (FLAGS_bbh.contains("tilegrid")) { | 50 if (FLAGS_bbh.contains("tilegrid")) { |
51 SkTileGridFactory::TileGridInfo info; | 51 SkTileGridFactory::TileGridInfo info; |
52 info.fTileInterval.set(FLAGS_tileGridSize, FLAGS_tileGridSize); | 52 info.fTileInterval.set(FLAGS_tileGridSize, FLAGS_tileGridSize); |
53 info.fMargin.setEmpty(); | 53 info.fMargin.setEmpty(); |
54 info.fOffset.setZero(); | 54 info.fOffset.setZero(); |
55 return SkNEW_ARGS(SkTileGridFactory, (info)); | 55 return SkNEW_ARGS(SkTileGridFactory, (info)); |
56 } | 56 } |
57 if (FLAGS_bbh.contains("quadtree")) { | 57 SkDebugf("Invalid bbh type %s, must be one of rtree, tilegrid.\n", FLAGS_bbh
[0]); |
58 return SkNEW(SkQuadTreeFactory); | |
59 } | |
60 SkDebugf("Invalid bbh type %s, must be one of rtree, tilegrid, quadtree.\n",
FLAGS_bbh[0]); | |
61 return NULL; | 58 return NULL; |
62 } | 59 } |
63 | 60 |
64 static void rerecord(const SkPicture& src, SkBBHFactory* bbhFactory) { | 61 static void rerecord(const SkPicture& src, SkBBHFactory* bbhFactory) { |
65 SkPictureRecorder recorder; | 62 SkPictureRecorder recorder; |
66 if (FLAGS_skr) { | 63 if (FLAGS_skr) { |
67 src.draw(recorder.EXPERIMENTAL_beginRecording(src.width(), src.height(),
bbhFactory)); | 64 src.draw(recorder.EXPERIMENTAL_beginRecording(src.width(), src.height(),
bbhFactory)); |
68 } else { | 65 } else { |
69 src.draw(recorder. DEPRECATED_beginRecording(src.width(), src.height(),
bbhFactory)); | 66 src.draw(recorder. DEPRECATED_beginRecording(src.width(), src.height(),
bbhFactory)); |
70 } | 67 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 bench_record(*src, overheadEstimate, filename.c_str(), bbhFactory.get())
; | 164 bench_record(*src, overheadEstimate, filename.c_str(), bbhFactory.get())
; |
168 } | 165 } |
169 return failed ? 1 : 0; | 166 return failed ? 1 : 0; |
170 } | 167 } |
171 | 168 |
172 #if !defined SK_BUILD_FOR_IOS | 169 #if !defined SK_BUILD_FOR_IOS |
173 int main(int argc, char * const argv[]) { | 170 int main(int argc, char * const argv[]) { |
174 return tool_main(argc, (char**) argv); | 171 return tool_main(argc, (char**) argv); |
175 } | 172 } |
176 #endif | 173 #endif |
OLD | NEW |