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 "Benchmark.h" | 7 #include "Benchmark.h" |
8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
9 #include "SkMatrixUtils.h" | 9 #include "SkMatrixUtils.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 fM.setScale(2, 3); | 313 fM.setScale(2, 3); |
314 fM.postTranslate(1, 2); | 314 fM.postTranslate(1, 2); |
315 | 315 |
316 fR.set(10, 10, 100, 200); | 316 fR.set(10, 10, 100, 200); |
317 } | 317 } |
318 | 318 |
319 void performTest() override { | 319 void performTest() override { |
320 SkRect dst; | 320 SkRect dst; |
321 if (fScaleTrans) { | 321 if (fScaleTrans) { |
322 for (int i = 0; i < MEGA_LOOP; ++i) { | 322 for (int i = 0; i < MEGA_LOOP; ++i) { |
323 dst = fM.mapRectScaleTranslate(fR); | 323 fM.mapRectScaleTranslate(&dst, fR); |
324 } | 324 } |
325 } else { | 325 } else { |
326 for (int i = 0; i < MEGA_LOOP; ++i) { | 326 for (int i = 0; i < MEGA_LOOP; ++i) { |
327 fM.mapRect(&dst, fR); | 327 fM.mapRect(&dst, fR); |
328 } | 328 } |
329 } | 329 } |
330 } | 330 } |
331 }; | 331 }; |
332 DEF_BENCH( return new MapRectMatrixBench("maprect", false); ) | 332 DEF_BENCH( return new MapRectMatrixBench("maprect", false); ) |
333 DEF_BENCH( return new MapRectMatrixBench("maprectscaletrans", true); ) | 333 DEF_BENCH( return new MapRectMatrixBench("maprectscaletrans", true); ) |
OLD | NEW |