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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 private: | 132 private: |
133 typedef PictureNesting INHERITED; | 133 typedef PictureNesting INHERITED; |
134 }; | 134 }; |
135 | 135 |
136 class PictureNestingPlayback : public PictureNesting { | 136 class PictureNestingPlayback : public PictureNesting { |
137 public: | 137 public: |
138 PictureNestingPlayback(int maxLevel, int maxPictureLevel) | 138 PictureNestingPlayback(int maxLevel, int maxPictureLevel) |
139 : INHERITED("playback", maxLevel, maxPictureLevel) { | 139 : INHERITED("playback", maxLevel, maxPictureLevel) { |
140 } | 140 } |
141 protected: | 141 protected: |
142 void onPreDraw() override { | 142 void onDelayedSetup() override { |
143 this->INHERITED::onPreDraw(); | 143 this->INHERITED::onDelayedSetup(); |
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 |
(...skipping 21 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 |