OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "Benchmark.h" | 9 #include "Benchmark.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 paint.setXfermode(fXfermode.get()); | 39 paint.setXfermode(fXfermode.get()); |
40 paint.setColor(random.nextU()); | 40 paint.setColor(random.nextU()); |
41 SkScalar w = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo
Scalar(kMaxSize)); | 41 SkScalar w = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo
Scalar(kMaxSize)); |
42 SkScalar h = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo
Scalar(kMaxSize)); | 42 SkScalar h = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo
Scalar(kMaxSize)); |
43 SkRect rect = SkRect::MakeXYWH( | 43 SkRect rect = SkRect::MakeXYWH( |
44 random.nextUScalar1() * (size.fWidth - w), | 44 random.nextUScalar1() * (size.fWidth - w), |
45 random.nextUScalar1() * (size.fHeight - h), | 45 random.nextUScalar1() * (size.fHeight - h), |
46 w, | 46 w, |
47 h | 47 h |
48 ); | 48 ); |
49 canvas->drawRect(rect, paint); | 49 for (int j = 0; j < 1000; ++j) { |
| 50 canvas->drawRect(rect, paint); |
| 51 } |
50 } | 52 } |
51 } | 53 } |
52 | 54 |
53 private: | 55 private: |
54 enum { | 56 enum { |
55 kMinSize = 50, | 57 kMinSize = 50, |
56 kMaxSize = 100, | 58 kMaxSize = 100, |
57 }; | 59 }; |
58 SkAutoTUnref<SkXfermode> fXfermode; | 60 SkAutoTUnref<SkXfermode> fXfermode; |
59 SkString fName; | 61 SkString fName; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 BENCH(SkXfermode::kDifference_Mode) | 120 BENCH(SkXfermode::kDifference_Mode) |
119 BENCH(SkXfermode::kExclusion_Mode) | 121 BENCH(SkXfermode::kExclusion_Mode) |
120 BENCH(SkXfermode::kMultiply_Mode) | 122 BENCH(SkXfermode::kMultiply_Mode) |
121 | 123 |
122 BENCH(SkXfermode::kHue_Mode) | 124 BENCH(SkXfermode::kHue_Mode) |
123 BENCH(SkXfermode::kSaturation_Mode) | 125 BENCH(SkXfermode::kSaturation_Mode) |
124 BENCH(SkXfermode::kColor_Mode) | 126 BENCH(SkXfermode::kColor_Mode) |
125 BENCH(SkXfermode::kLuminosity_Mode) | 127 BENCH(SkXfermode::kLuminosity_Mode) |
126 | 128 |
127 DEF_BENCH(return new XferCreateBench;) | 129 DEF_BENCH(return new XferCreateBench;) |
OLD | NEW |