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 28 matching lines...) Expand all Loading... |
39 SkString fName; | 39 SkString fName; |
40 }; | 40 }; |
41 | 41 |
42 class GeoRectBench : public GeometryBench { | 42 class GeoRectBench : public GeometryBench { |
43 public: | 43 public: |
44 GeoRectBench(const char suffix[]) : GeometryBench(suffix) {} | 44 GeoRectBench(const char suffix[]) : GeometryBench(suffix) {} |
45 | 45 |
46 protected: | 46 protected: |
47 SkRect fRects[2048]; | 47 SkRect fRects[2048]; |
48 | 48 |
49 virtual void onPreDraw() { | 49 virtual void onDelayedSetup() { |
50 const SkScalar min = -100; | 50 const SkScalar min = -100; |
51 const SkScalar max = 100; | 51 const SkScalar max = 100; |
52 SkRandom rand; | 52 SkRandom rand; |
53 for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) { | 53 for (size_t i = 0; i < SK_ARRAY_COUNT(fRects); ++i) { |
54 SkScalar x = rand.nextRangeScalar(min, max); | 54 SkScalar x = rand.nextRangeScalar(min, max); |
55 SkScalar y = rand.nextRangeScalar(min, max); | 55 SkScalar y = rand.nextRangeScalar(min, max); |
56 SkScalar w = rand.nextRangeScalar(min, max); | 56 SkScalar w = rand.nextRangeScalar(min, max); |
57 SkScalar h = rand.nextRangeScalar(min, max); | 57 SkScalar h = rand.nextRangeScalar(min, max); |
58 fRects[i].setXYWH(x, y, w, h); | 58 fRects[i].setXYWH(x, y, w, h); |
59 } | 59 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 for (int outer = 0; outer < loops; ++outer) { | 237 for (int outer = 0; outer < loops; ++outer) { |
238 SkChopCubicAt(fPts, dst, 0.5f); | 238 SkChopCubicAt(fPts, dst, 0.5f); |
239 SkChopCubicAt(fPts, dst, 0.5f); | 239 SkChopCubicAt(fPts, dst, 0.5f); |
240 SkChopCubicAt(fPts, dst, 0.5f); | 240 SkChopCubicAt(fPts, dst, 0.5f); |
241 SkChopCubicAt(fPts, dst, 0.5f); | 241 SkChopCubicAt(fPts, dst, 0.5f); |
242 } | 242 } |
243 } | 243 } |
244 }; | 244 }; |
245 DEF_BENCH( return new ChopCubicAt; ) | 245 DEF_BENCH( return new ChopCubicAt; ) |
246 | 246 |
OLD | NEW |