OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "Benchmark.h" | 7 #include "Benchmark.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 switch (fMode) { | 156 switch (fMode) { |
157 case kTiled: fName.append("_tiled" ); break; | 157 case kTiled: fName.append("_tiled" ); break; |
158 case kRandom: fName.append("_random"); break; | 158 case kRandom: fName.append("_random"); break; |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 const char* onGetName() override { return fName.c_str(); } | 162 const char* onGetName() override { return fName.c_str(); } |
163 SkIPoint onGetSize() override { return SkIPoint::Make(1024,1024); } | 163 SkIPoint onGetSize() override { return SkIPoint::Make(1024,1024); } |
164 | 164 |
165 void onPreDraw() override { | 165 void onDelayedSetup() override { |
166 SkAutoTDelete<SkBBHFactory> factory; | 166 SkAutoTDelete<SkBBHFactory> factory; |
167 switch (fBBH) { | 167 switch (fBBH) { |
168 case kNone: break; | 168 case kNone: break; |
169 case kRTree: factory.reset(new SkRTreeFactory); break; | 169 case kRTree: factory.reset(new SkRTreeFactory); break; |
170 } | 170 } |
171 | 171 |
172 SkPictureRecorder recorder; | 172 SkPictureRecorder recorder; |
173 SkCanvas* canvas = recorder.beginRecording(1024, 1024, factory); | 173 SkCanvas* canvas = recorder.beginRecording(1024, 1024, factory); |
174 SkRandom rand; | 174 SkRandom rand; |
175 for (int i = 0; i < 10000; i++) { | 175 for (int i = 0; i < 10000; i++) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 BBH fBBH; | 210 BBH fBBH; |
211 Mode fMode; | 211 Mode fMode; |
212 SkString fName; | 212 SkString fName; |
213 SkAutoTUnref<SkPicture> fPic; | 213 SkAutoTUnref<SkPicture> fPic; |
214 }; | 214 }; |
215 | 215 |
216 DEF_BENCH( return new TiledPlaybackBench(kNone, kRandom); ) | 216 DEF_BENCH( return new TiledPlaybackBench(kNone, kRandom); ) |
217 DEF_BENCH( return new TiledPlaybackBench(kNone, kTiled ); ) | 217 DEF_BENCH( return new TiledPlaybackBench(kNone, kTiled ); ) |
218 DEF_BENCH( return new TiledPlaybackBench(kRTree, kRandom); ) | 218 DEF_BENCH( return new TiledPlaybackBench(kRTree, kRandom); ) |
219 DEF_BENCH( return new TiledPlaybackBench(kRTree, kTiled ); ) | 219 DEF_BENCH( return new TiledPlaybackBench(kRTree, kTiled ); ) |
OLD | NEW |