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 "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 typedef Benchmark INHERITED; | 92 typedef Benchmark INHERITED; |
93 }; | 93 }; |
94 | 94 |
95 class PictureNestingRecording : public PictureNesting { | 95 class PictureNestingRecording : public PictureNesting { |
96 public: | 96 public: |
97 PictureNestingRecording(int maxLevel, int maxPictureLevel) | 97 PictureNestingRecording(int maxLevel, int maxPictureLevel) |
98 : INHERITED("recording", maxLevel, maxPictureLevel) { | 98 : INHERITED("recording", maxLevel, maxPictureLevel) { |
99 } | 99 } |
100 | 100 |
101 protected: | 101 protected: |
102 virtual void onDraw(const int loops, SkCanvas* canvas) { | 102 virtual bool isSuitableFor(Backend backend) { |
| 103 return backend == kNonRendering_Backend; |
| 104 } |
| 105 |
| 106 virtual void onDraw(const int loops, SkCanvas*) { |
103 SkIPoint canvasSize = onGetSize(); | 107 SkIPoint canvasSize = onGetSize(); |
104 SkPictureRecorder recorder; | 108 SkPictureRecorder recorder; |
105 | 109 |
106 for (int i = 0; i < loops; i++) { | 110 for (int i = 0; i < loops; i++) { |
107 SkCanvas* c = recorder.beginRecording(SkIntToScalar(canvasSize.x()), | 111 SkCanvas* c = recorder.beginRecording(SkIntToScalar(canvasSize.x()), |
108 SkIntToScalar(canvasSize.y()))
; | 112 SkIntToScalar(canvasSize.y()))
; |
109 this->doDraw(c); | 113 this->doDraw(c); |
110 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 114 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
111 } | 115 } |
112 } | 116 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 158 |
155 DEF_BENCH( return new PictureNestingPlayback(8, 0); ) | 159 DEF_BENCH( return new PictureNestingPlayback(8, 0); ) |
156 DEF_BENCH( return new PictureNestingPlayback(8, 1); ) | 160 DEF_BENCH( return new PictureNestingPlayback(8, 1); ) |
157 DEF_BENCH( return new PictureNestingPlayback(8, 2); ) | 161 DEF_BENCH( return new PictureNestingPlayback(8, 2); ) |
158 DEF_BENCH( return new PictureNestingPlayback(8, 3); ) | 162 DEF_BENCH( return new PictureNestingPlayback(8, 3); ) |
159 DEF_BENCH( return new PictureNestingPlayback(8, 4); ) | 163 DEF_BENCH( return new PictureNestingPlayback(8, 4); ) |
160 DEF_BENCH( return new PictureNestingPlayback(8, 5); ) | 164 DEF_BENCH( return new PictureNestingPlayback(8, 5); ) |
161 DEF_BENCH( return new PictureNestingPlayback(8, 6); ) | 165 DEF_BENCH( return new PictureNestingPlayback(8, 6); ) |
162 DEF_BENCH( return new PictureNestingPlayback(8, 7); ) | 166 DEF_BENCH( return new PictureNestingPlayback(8, 7); ) |
163 DEF_BENCH( return new PictureNestingPlayback(8, 8); ) | 167 DEF_BENCH( return new PictureNestingPlayback(8, 8); ) |
OLD | NEW |