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 "SkBlurMask.h" | 8 #include "SkBlurMask.h" |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 paint.setAntiAlias(true); | 59 paint.setAntiAlias(true); |
60 | 60 |
61 SkRandom rand; | 61 SkRandom rand; |
62 for (int i = 0; i < loops; i++) { | 62 for (int i = 0; i < loops; i++) { |
63 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, | 63 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, |
64 rand.nextUScalar1() * 400); | 64 rand.nextUScalar1() * 400); |
65 r.offset(fRadius, fRadius); | 65 r.offset(fRadius, fRadius); |
66 | 66 |
67 if (fRadius > 0) { | 67 if (fRadius > 0) { |
68 SkMaskFilter* mf = SkBlurMaskFilter::Create(fStyle, | 68 paint.setMaskFilter(SkBlurMaskFilter::Make(fStyle, |
69 SkBlurMask::ConvertRadiusToSigma(fRa
dius), | 69 SkBlurMask::ConvertRad
iusToSigma(fRadius), |
70 fFlags); | 70 fFlags)); |
71 paint.setMaskFilter(mf)->unref(); | |
72 } | 71 } |
73 canvas->drawOval(r, paint); | 72 canvas->drawOval(r, paint); |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 private: | 76 private: |
78 typedef Benchmark INHERITED; | 77 typedef Benchmark INHERITED; |
79 }; | 78 }; |
80 | 79 |
81 DEF_BENCH(return new BlurBench(MINI, kNormal_SkBlurStyle);) | 80 DEF_BENCH(return new BlurBench(MINI, kNormal_SkBlurStyle);) |
(...skipping 25 matching lines...) Expand all Loading... |
107 | 106 |
108 DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHi
ghQuality_BlurFlag);) | 107 DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHi
ghQuality_BlurFlag);) |
109 | 108 |
110 DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHigh
Quality_BlurFlag);) | 109 DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHigh
Quality_BlurFlag);) |
111 | 110 |
112 DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle, SkBlurMaskFilter::k
HighQuality_BlurFlag);) | 111 DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle, SkBlurMaskFilter::k
HighQuality_BlurFlag);) |
113 | 112 |
114 DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHig
hQuality_BlurFlag);) | 113 DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHig
hQuality_BlurFlag);) |
115 | 114 |
116 DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);) | 115 DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);) |
OLD | NEW |