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 "SkGeometry.h" | 9 #include "SkGeometry.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 result = SkEvalQuadTangentAt(fPts, 0.5f); | 205 result = SkEvalQuadTangentAt(fPts, 0.5f); |
206 result = SkEvalQuadTangentAt(fPts, 0.5f); | 206 result = SkEvalQuadTangentAt(fPts, 0.5f); |
207 result = SkEvalQuadTangentAt(fPts, 0.5f); | 207 result = SkEvalQuadTangentAt(fPts, 0.5f); |
208 } | 208 } |
209 } | 209 } |
210 }; | 210 }; |
211 DEF_BENCH( return new EvalQuadTangentAt1; ) | 211 DEF_BENCH( return new EvalQuadTangentAt1; ) |
212 | 212 |
213 //////// | 213 //////// |
214 | 214 |
215 class ChopQuadAt0 : public QuadBenchBase { | 215 class ChopQuadAt : public QuadBenchBase { |
216 public: | 216 public: |
217 ChopQuadAt0() : QuadBenchBase("chopquadat0") {} | 217 ChopQuadAt() : QuadBenchBase("chopquadat") {} |
218 protected: | 218 protected: |
219 void onDraw(const int loops, SkCanvas* canvas) override { | 219 void onDraw(const int loops, SkCanvas* canvas) override { |
220 SkPoint dst[5]; | 220 SkPoint dst[5]; |
221 for (int outer = 0; outer < loops; ++outer) { | 221 for (int outer = 0; outer < loops; ++outer) { |
222 SkChopQuadAt(fPts, dst, 0.5f); | 222 SkChopQuadAt(fPts, dst, 0.5f); |
223 SkChopQuadAt(fPts, dst, 0.5f); | 223 SkChopQuadAt(fPts, dst, 0.5f); |
224 SkChopQuadAt(fPts, dst, 0.5f); | 224 SkChopQuadAt(fPts, dst, 0.5f); |
225 SkChopQuadAt(fPts, dst, 0.5f); | 225 SkChopQuadAt(fPts, dst, 0.5f); |
226 } | 226 } |
227 } | 227 } |
228 }; | 228 }; |
229 DEF_BENCH( return new ChopQuadAt0; ) | 229 DEF_BENCH( return new ChopQuadAt; ) |
230 | 230 |
231 class ChopQuadAt1 : public QuadBenchBase { | 231 class ChopCubicAt : public QuadBenchBase { |
232 public: | 232 public: |
233 ChopQuadAt1() : QuadBenchBase("chopquadat1") {} | 233 ChopCubicAt() : QuadBenchBase("chopcubicat0") {} |
234 protected: | |
235 void onDraw(const int loops, SkCanvas* canvas) override { | |
236 SkPoint dst[5]; | |
237 for (int outer = 0; outer < loops; ++outer) { | |
238 SkChopQuadAt2(fPts, dst, 0.5f); | |
239 SkChopQuadAt2(fPts, dst, 0.5f); | |
240 SkChopQuadAt2(fPts, dst, 0.5f); | |
241 SkChopQuadAt2(fPts, dst, 0.5f); | |
242 } | |
243 } | |
244 }; | |
245 DEF_BENCH( return new ChopQuadAt1; ) | |
246 | |
247 class ChopCubicAt0 : public QuadBenchBase { | |
248 public: | |
249 ChopCubicAt0() : QuadBenchBase("chopcubicat0") {} | |
250 protected: | 234 protected: |
251 void onDraw(const int loops, SkCanvas* canvas) override { | 235 void onDraw(const int loops, SkCanvas* canvas) override { |
252 SkPoint dst[7]; | 236 SkPoint dst[7]; |
253 for (int outer = 0; outer < loops; ++outer) { | 237 for (int outer = 0; outer < loops; ++outer) { |
254 SkChopCubicAt(fPts, dst, 0.5f); | 238 SkChopCubicAt(fPts, dst, 0.5f); |
255 SkChopCubicAt(fPts, dst, 0.5f); | 239 SkChopCubicAt(fPts, dst, 0.5f); |
256 SkChopCubicAt(fPts, dst, 0.5f); | 240 SkChopCubicAt(fPts, dst, 0.5f); |
257 SkChopCubicAt(fPts, dst, 0.5f); | 241 SkChopCubicAt(fPts, dst, 0.5f); |
258 } | 242 } |
259 } | 243 } |
260 }; | 244 }; |
261 DEF_BENCH( return new ChopCubicAt0; ) | 245 DEF_BENCH( return new ChopCubicAt; ) |
262 | 246 |
263 class ChopCubicAt1 : public QuadBenchBase { | |
264 public: | |
265 ChopCubicAt1() : QuadBenchBase("chopcubicat1") {} | |
266 protected: | |
267 void onDraw(const int loops, SkCanvas* canvas) override { | |
268 SkPoint dst[7]; | |
269 for (int outer = 0; outer < loops; ++outer) { | |
270 SkChopCubicAt2(fPts, dst, 0.5f); | |
271 SkChopCubicAt2(fPts, dst, 0.5f); | |
272 SkChopCubicAt2(fPts, dst, 0.5f); | |
273 SkChopCubicAt2(fPts, dst, 0.5f); | |
274 } | |
275 } | |
276 }; | |
277 DEF_BENCH( return new ChopCubicAt1; ) | |
278 | |
OLD | NEW |