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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual const char* onGetName() { | 52 virtual const char* onGetName() { |
53 return fName.c_str(); | 53 return fName.c_str(); |
54 } | 54 } |
55 | 55 |
56 virtual void onDraw(SkCanvas* canvas) { | 56 virtual void onDraw(SkCanvas* canvas) { |
57 SkPaint paint; | 57 SkPaint paint; |
58 this->setupPaint(&paint); | 58 this->setupPaint(&paint); |
59 | 59 |
60 paint.setAntiAlias(true); | 60 paint.setAntiAlias(true); |
61 | 61 |
62 SkMWCRandom rand; | 62 SkRandom rand; |
63 for (int i = 0; i < SkBENCHLOOP(10); i++) { | 63 for (int i = 0; i < SkBENCHLOOP(10); i++) { |
64 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, | 64 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, |
65 rand.nextUScalar1() * 400); | 65 rand.nextUScalar1() * 400); |
66 r.offset(fRadius, fRadius); | 66 r.offset(fRadius, fRadius); |
67 | 67 |
68 if (fRadius > 0) { | 68 if (fRadius > 0) { |
69 SkMaskFilter* mf = SkBlurMaskFilter::Create(fStyle, | 69 SkMaskFilter* mf = SkBlurMaskFilter::Create(fStyle, |
70 SkBlurMask::ConvertRadiusToSigma(fRa
dius), | 70 SkBlurMask::ConvertRadiusToSigma(fRa
dius), |
71 fFlags); | 71 fFlags); |
72 paint.setMaskFilter(mf)->unref(); | 72 paint.setMaskFilter(mf)->unref(); |
(...skipping 28 matching lines...) Expand all Loading... |
101 | 101 |
102 DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kNormal_BlurStyle, Sk
BlurMaskFilter::kHighQuality_BlurFlag);) | 102 DEF_BENCH(return new BlurBench(p, SMALL, SkBlurMaskFilter::kNormal_BlurStyle, Sk
BlurMaskFilter::kHighQuality_BlurFlag);) |
103 | 103 |
104 DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBl
urMaskFilter::kHighQuality_BlurFlag);) | 104 DEF_BENCH(return new BlurBench(p, BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBl
urMaskFilter::kHighQuality_BlurFlag);) |
105 | 105 |
106 DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kNormal_BlurStyle,
SkBlurMaskFilter::kHighQuality_BlurFlag);) | 106 DEF_BENCH(return new BlurBench(p, REALBIG, SkBlurMaskFilter::kNormal_BlurStyle,
SkBlurMaskFilter::kHighQuality_BlurFlag);) |
107 | 107 |
108 DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkB
lurMaskFilter::kHighQuality_BlurFlag);) | 108 DEF_BENCH(return new BlurBench(p, REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkB
lurMaskFilter::kHighQuality_BlurFlag);) |
109 | 109 |
110 DEF_BENCH(return new BlurBench(p, 0, SkBlurMaskFilter::kNormal_BlurStyle);) | 110 DEF_BENCH(return new BlurBench(p, 0, SkBlurMaskFilter::kNormal_BlurStyle);) |
OLD | NEW |