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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 typedef Benchmark INHERITED; | 106 typedef Benchmark INHERITED; |
107 }; | 107 }; |
108 | 108 |
109 class PictureNestingRecording : public PictureNesting { | 109 class PictureNestingRecording : public PictureNesting { |
110 public: | 110 public: |
111 PictureNestingRecording(int maxLevel, int maxPictureLevel) | 111 PictureNestingRecording(int maxLevel, int maxPictureLevel) |
112 : INHERITED("recording", maxLevel, maxPictureLevel) { | 112 : INHERITED("recording", maxLevel, maxPictureLevel) { |
113 } | 113 } |
114 | 114 |
115 protected: | 115 protected: |
116 virtual bool isSuitableFor(Backend backend) { | 116 bool isSuitableFor(Backend backend) override { |
117 return backend == kNonRendering_Backend; | 117 return backend == kNonRendering_Backend; |
118 } | 118 } |
119 | 119 |
120 virtual void onDraw(const int loops, SkCanvas*) { | 120 void onDraw(const int loops, SkCanvas*) override { |
121 SkIPoint canvasSize = onGetSize(); | 121 SkIPoint canvasSize = onGetSize(); |
122 SkPictureRecorder recorder; | 122 SkPictureRecorder recorder; |
123 | 123 |
124 for (int i = 0; i < loops; i++) { | 124 for (int i = 0; i < loops; i++) { |
125 SkCanvas* c = recorder.beginRecording(SkIntToScalar(canvasSize.x()), | 125 SkCanvas* c = recorder.beginRecording(SkIntToScalar(canvasSize.x()), |
126 SkIntToScalar(canvasSize.y()))
; | 126 SkIntToScalar(canvasSize.y()))
; |
127 this->doDraw(c); | 127 this->doDraw(c); |
128 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 128 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
129 } | 129 } |
130 } | 130 } |
(...skipping 13 matching lines...) Expand all Loading... |
144 | 144 |
145 SkIPoint canvasSize = onGetSize(); | 145 SkIPoint canvasSize = onGetSize(); |
146 SkPictureRecorder recorder; | 146 SkPictureRecorder recorder; |
147 SkCanvas* c = recorder.beginRecording(SkIntToScalar(canvasSize.x()), | 147 SkCanvas* c = recorder.beginRecording(SkIntToScalar(canvasSize.x()), |
148 SkIntToScalar(canvasSize.y())); | 148 SkIntToScalar(canvasSize.y())); |
149 | 149 |
150 this->doDraw(c); | 150 this->doDraw(c); |
151 fPicture.reset(recorder.endRecording()); | 151 fPicture.reset(recorder.endRecording()); |
152 } | 152 } |
153 | 153 |
154 virtual void onDraw(const int loops, SkCanvas* canvas) { | 154 void onDraw(const int loops, SkCanvas* canvas) override { |
155 for (int i = 0; i < loops; i++) { | 155 for (int i = 0; i < loops; i++) { |
156 canvas->drawPicture(fPicture); | 156 canvas->drawPicture(fPicture); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 private: | 160 private: |
161 SkAutoTUnref<SkPicture> fPicture; | 161 SkAutoTUnref<SkPicture> fPicture; |
162 | 162 |
163 typedef PictureNesting INHERITED; | 163 typedef PictureNesting INHERITED; |
164 }; | 164 }; |
(...skipping 10 matching lines...) Expand all Loading... |
175 | 175 |
176 DEF_BENCH( return new PictureNestingPlayback(8, 0); ) | 176 DEF_BENCH( return new PictureNestingPlayback(8, 0); ) |
177 DEF_BENCH( return new PictureNestingPlayback(8, 1); ) | 177 DEF_BENCH( return new PictureNestingPlayback(8, 1); ) |
178 DEF_BENCH( return new PictureNestingPlayback(8, 2); ) | 178 DEF_BENCH( return new PictureNestingPlayback(8, 2); ) |
179 DEF_BENCH( return new PictureNestingPlayback(8, 3); ) | 179 DEF_BENCH( return new PictureNestingPlayback(8, 3); ) |
180 DEF_BENCH( return new PictureNestingPlayback(8, 4); ) | 180 DEF_BENCH( return new PictureNestingPlayback(8, 4); ) |
181 DEF_BENCH( return new PictureNestingPlayback(8, 5); ) | 181 DEF_BENCH( return new PictureNestingPlayback(8, 5); ) |
182 DEF_BENCH( return new PictureNestingPlayback(8, 6); ) | 182 DEF_BENCH( return new PictureNestingPlayback(8, 6); ) |
183 DEF_BENCH( return new PictureNestingPlayback(8, 7); ) | 183 DEF_BENCH( return new PictureNestingPlayback(8, 7); ) |
184 DEF_BENCH( return new PictureNestingPlayback(8, 8); ) | 184 DEF_BENCH( return new PictureNestingPlayback(8, 8); ) |
OLD | NEW |