OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkRandom.h" | 13 #include "SkRandom.h" |
14 #include "SkShader.h" | 14 #include "SkShader.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 | 16 |
| 17 #define MINI 0.01f |
17 #define SMALL SkIntToScalar(2) | 18 #define SMALL SkIntToScalar(2) |
18 #define REAL 1.5f | 19 #define REAL 1.5f |
19 #define BIG SkIntToScalar(10) | 20 #define BIG SkIntToScalar(10) |
20 #define REALBIG 100.5f | 21 #define REALBIG 100.5f |
21 | 22 |
22 static const char* gStyleName[] = { | 23 static const char* gStyleName[] = { |
23 "normal", | 24 "normal", |
24 "solid", | 25 "solid", |
25 "outer", | 26 "outer", |
26 "inner" | 27 "inner" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 paint.setMaskFilter(mf)->unref(); | 72 paint.setMaskFilter(mf)->unref(); |
72 } | 73 } |
73 canvas->drawOval(r, paint); | 74 canvas->drawOval(r, paint); |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 private: | 78 private: |
78 typedef Benchmark INHERITED; | 79 typedef Benchmark INHERITED; |
79 }; | 80 }; |
80 | 81 |
| 82 DEF_BENCH(return new BlurBench(MINI, kNormal_SkBlurStyle);) |
| 83 DEF_BENCH(return new BlurBench(MINI, kSolid_SkBlurStyle);) |
| 84 DEF_BENCH(return new BlurBench(MINI, kOuter_SkBlurStyle);) |
| 85 DEF_BENCH(return new BlurBench(MINI, kInner_SkBlurStyle);) |
| 86 |
81 DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle);) | 87 DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle);) |
82 DEF_BENCH(return new BlurBench(SMALL, kSolid_SkBlurStyle);) | 88 DEF_BENCH(return new BlurBench(SMALL, kSolid_SkBlurStyle);) |
83 DEF_BENCH(return new BlurBench(SMALL, kOuter_SkBlurStyle);) | 89 DEF_BENCH(return new BlurBench(SMALL, kOuter_SkBlurStyle);) |
84 DEF_BENCH(return new BlurBench(SMALL, kInner_SkBlurStyle);) | 90 DEF_BENCH(return new BlurBench(SMALL, kInner_SkBlurStyle);) |
85 | 91 |
86 DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle);) | 92 DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle);) |
87 DEF_BENCH(return new BlurBench(BIG, kSolid_SkBlurStyle);) | 93 DEF_BENCH(return new BlurBench(BIG, kSolid_SkBlurStyle);) |
88 DEF_BENCH(return new BlurBench(BIG, kOuter_SkBlurStyle);) | 94 DEF_BENCH(return new BlurBench(BIG, kOuter_SkBlurStyle);) |
89 DEF_BENCH(return new BlurBench(BIG, kInner_SkBlurStyle);) | 95 DEF_BENCH(return new BlurBench(BIG, kInner_SkBlurStyle);) |
90 | 96 |
91 DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle);) | 97 DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle);) |
92 DEF_BENCH(return new BlurBench(REALBIG, kSolid_SkBlurStyle);) | 98 DEF_BENCH(return new BlurBench(REALBIG, kSolid_SkBlurStyle);) |
93 DEF_BENCH(return new BlurBench(REALBIG, kOuter_SkBlurStyle);) | 99 DEF_BENCH(return new BlurBench(REALBIG, kOuter_SkBlurStyle);) |
94 DEF_BENCH(return new BlurBench(REALBIG, kInner_SkBlurStyle);) | 100 DEF_BENCH(return new BlurBench(REALBIG, kInner_SkBlurStyle);) |
95 | 101 |
96 DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle);) | 102 DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle);) |
97 DEF_BENCH(return new BlurBench(REAL, kSolid_SkBlurStyle);) | 103 DEF_BENCH(return new BlurBench(REAL, kSolid_SkBlurStyle);) |
98 DEF_BENCH(return new BlurBench(REAL, kOuter_SkBlurStyle);) | 104 DEF_BENCH(return new BlurBench(REAL, kOuter_SkBlurStyle);) |
99 DEF_BENCH(return new BlurBench(REAL, kInner_SkBlurStyle);) | 105 DEF_BENCH(return new BlurBench(REAL, kInner_SkBlurStyle);) |
100 | 106 |
| 107 DEF_BENCH(return new BlurBench(MINI, kNormal_SkBlurStyle, SkBlurMaskFilter::kHig
hQuality_BlurFlag);) |
| 108 |
101 DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHi
ghQuality_BlurFlag);) | 109 DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHi
ghQuality_BlurFlag);) |
102 | 110 |
103 DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHigh
Quality_BlurFlag);) | 111 DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHigh
Quality_BlurFlag);) |
104 | 112 |
105 DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle, SkBlurMaskFilter::k
HighQuality_BlurFlag);) | 113 DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle, SkBlurMaskFilter::k
HighQuality_BlurFlag);) |
106 | 114 |
107 DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHig
hQuality_BlurFlag);) | 115 DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHig
hQuality_BlurFlag);) |
108 | 116 |
109 DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);) | 117 DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);) |
OLD | NEW |