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 22 matching lines...) Expand all Loading... |
33 TEXT_SIZE = 10 | 33 TEXT_SIZE = 10 |
34 }; | 34 }; |
35 protected: | 35 protected: |
36 virtual const char* onGetName() { | 36 virtual const char* onGetName() { |
37 return fName.c_str(); | 37 return fName.c_str(); |
38 } | 38 } |
39 | 39 |
40 virtual void onDraw(const int loops, SkCanvas* canvas) { | 40 virtual void onDraw(const int loops, SkCanvas* canvas) { |
41 | 41 |
42 SkPictureRecorder recorder; | 42 SkPictureRecorder recorder; |
43 SkCanvas* pCanvas = recorder.beginRecording(PICTURE_WIDTH, PICTURE_HEIGH
T, NULL, 0); | 43 SkCanvas* pCanvas = recorder.beginRecording(PICTURE_WIDTH, PICTURE_HEIGH
T, nullptr, 0); |
44 this->recordCanvas(pCanvas); | 44 this->recordCanvas(pCanvas); |
45 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 45 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
46 | 46 |
47 const SkPoint translateDelta = getTranslateDelta(loops); | 47 const SkPoint translateDelta = getTranslateDelta(loops); |
48 | 48 |
49 for (int i = 0; i < loops; i++) { | 49 for (int i = 0; i < loops; i++) { |
50 picture->playback(canvas); | 50 picture->playback(canvas); |
51 canvas->translate(translateDelta.fX, translateDelta.fY); | 51 canvas->translate(translateDelta.fX, translateDelta.fY); |
52 } | 52 } |
53 } | 53 } |
(...skipping 156 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 |