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 "SkBenchmark.h" | 7 #include "SkBenchmark.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 20 matching lines...) Expand all Loading... |
31 TEXT_SIZE = 10 | 31 TEXT_SIZE = 10 |
32 }; | 32 }; |
33 protected: | 33 protected: |
34 virtual const char* onGetName() { | 34 virtual const char* onGetName() { |
35 return fName.c_str(); | 35 return fName.c_str(); |
36 } | 36 } |
37 | 37 |
38 virtual void onDraw(const int loops, SkCanvas* canvas) { | 38 virtual void onDraw(const int loops, SkCanvas* canvas) { |
39 | 39 |
40 SkPictureRecorder recorder; | 40 SkPictureRecorder recorder; |
41 SkCanvas* pCanvas = recorder.beginRecording(PICTURE_WIDTH, PICTURE_HEIGH
T); | 41 SkCanvas* pCanvas = recorder.beginRecording(PICTURE_WIDTH, PICTURE_HEIGH
T, NULL, 0); |
42 this->recordCanvas(pCanvas); | 42 this->recordCanvas(pCanvas); |
43 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 43 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
44 | 44 |
45 const SkPoint translateDelta = getTranslateDelta(loops); | 45 const SkPoint translateDelta = getTranslateDelta(loops); |
46 | 46 |
47 for (int i = 0; i < loops; i++) { | 47 for (int i = 0; i < loops; i++) { |
48 picture->draw(canvas); | 48 picture->draw(canvas); |
49 canvas->translate(translateDelta.fX, translateDelta.fY); | 49 canvas->translate(translateDelta.fX, translateDelta.fY); |
50 } | 50 } |
51 } | 51 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 bool fDrawPosH; | 131 bool fDrawPosH; |
132 typedef PicturePlaybackBench INHERITED; | 132 typedef PicturePlaybackBench INHERITED; |
133 }; | 133 }; |
134 | 134 |
135 | 135 |
136 /////////////////////////////////////////////////////////////////////////////// | 136 /////////////////////////////////////////////////////////////////////////////// |
137 | 137 |
138 DEF_BENCH( return new TextPlaybackBench(); ) | 138 DEF_BENCH( return new TextPlaybackBench(); ) |
139 DEF_BENCH( return new PosTextPlaybackBench(true); ) | 139 DEF_BENCH( return new PosTextPlaybackBench(true); ) |
140 DEF_BENCH( return new PosTextPlaybackBench(false); ) | 140 DEF_BENCH( return new PosTextPlaybackBench(false); ) |
OLD | NEW |