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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } else { | 46 } else { |
47 fName.printf("blur_%d_%s_%s", SkScalarRoundToInt(rad), name, quality
); | 47 fName.printf("blur_%d_%s_%s", SkScalarRoundToInt(rad), name, quality
); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 protected: | 51 protected: |
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(const int loops, SkCanvas* canvas) { | 56 virtual void onDraw(int loops, 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 SkRandom rand; | 62 SkRandom rand; |
63 for (int i = 0; i < loops; i++) { | 63 for (int i = 0; i < loops; 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); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 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);) |
110 | 110 |
111 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);) |
112 | 112 |
113 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);) |
114 | 114 |
115 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);) |
116 | 116 |
117 DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);) | 117 DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);) |
OLD | NEW |