| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 7 |
| 8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } else { | 84 } else { |
| 85 name.printf("blurrect_direct_%d", SkScalarRoundToInt(rad)); | 85 name.printf("blurrect_direct_%d", SkScalarRoundToInt(rad)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 this->setName(name); | 88 this->setName(name); |
| 89 } | 89 } |
| 90 protected: | 90 protected: |
| 91 virtual void makeBlurryRect(const SkRect& r) SK_OVERRIDE { | 91 virtual void makeBlurryRect(const SkRect& r) SK_OVERRIDE { |
| 92 SkMask mask; | 92 SkMask mask; |
| 93 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()), | 93 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()), |
| 94 &mask, r, SkBlurMask::kNormal_Style); | 94 &mask, r, kNormal_SkBlurStyle); |
| 95 SkMask::FreeImage(mask.fImage); | 95 SkMask::FreeImage(mask.fImage); |
| 96 } | 96 } |
| 97 private: | 97 private: |
| 98 typedef BlurRectBench INHERITED; | 98 typedef BlurRectBench INHERITED; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class BlurRectSeparableBench: public BlurRectBench { | 101 class BlurRectSeparableBench: public BlurRectBench { |
| 102 | 102 |
| 103 public: | 103 public: |
| 104 BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) { | 104 BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 this->setName(name); | 140 this->setName(name); |
| 141 } | 141 } |
| 142 | 142 |
| 143 protected: | 143 protected: |
| 144 | 144 |
| 145 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { | 145 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { |
| 146 SkMask mask; | 146 SkMask mask; |
| 147 mask.fImage = NULL; | 147 mask.fImage = NULL; |
| 148 SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(th
is->radius()), | 148 SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(th
is->radius()), |
| 149 SkBlurMask::kNormal_Style, | 149 kNormal_SkBlurStyle, kHigh_SkBlurQuality); |
| 150 SkBlurMask::kHigh_Quality); | |
| 151 SkMask::FreeImage(mask.fImage); | 150 SkMask::FreeImage(mask.fImage); |
| 152 } | 151 } |
| 153 private: | 152 private: |
| 154 typedef BlurRectSeparableBench INHERITED; | 153 typedef BlurRectSeparableBench INHERITED; |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 class BlurRectGaussianBench: public BlurRectSeparableBench { | 156 class BlurRectGaussianBench: public BlurRectSeparableBench { |
| 158 public: | 157 public: |
| 159 BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) { | 158 BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) { |
| 160 SkString name; | 159 SkString name; |
| 161 | 160 |
| 162 if (SkScalarFraction(rad) != 0) { | 161 if (SkScalarFraction(rad) != 0) { |
| 163 name.printf("blurrect_gaussian_%.2f", SkScalarToFloat(rad)); | 162 name.printf("blurrect_gaussian_%.2f", SkScalarToFloat(rad)); |
| 164 } else { | 163 } else { |
| 165 name.printf("blurrect_gaussian_%d", SkScalarRoundToInt(rad)); | 164 name.printf("blurrect_gaussian_%d", SkScalarRoundToInt(rad)); |
| 166 } | 165 } |
| 167 | 166 |
| 168 this->setName(name); | 167 this->setName(name); |
| 169 } | 168 } |
| 170 | 169 |
| 171 protected: | 170 protected: |
| 172 | 171 |
| 173 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { | 172 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { |
| 174 SkMask mask; | 173 SkMask mask; |
| 175 mask.fImage = NULL; | 174 mask.fImage = NULL; |
| 176 SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radiu
s()), | 175 SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radiu
s()), |
| 177 &mask, fSrcMask, SkBlurMask::kNormal_Style); | 176 &mask, fSrcMask, kNormal_SkBlurStyle); |
| 178 SkMask::FreeImage(mask.fImage); | 177 SkMask::FreeImage(mask.fImage); |
| 179 } | 178 } |
| 180 private: | 179 private: |
| 181 typedef BlurRectSeparableBench INHERITED; | 180 typedef BlurRectSeparableBench INHERITED; |
| 182 }; | 181 }; |
| 183 | 182 |
| 184 DEF_BENCH(return new BlurRectBoxFilterBench(SMALL);) | 183 DEF_BENCH(return new BlurRectBoxFilterBench(SMALL);) |
| 185 DEF_BENCH(return new BlurRectBoxFilterBench(BIG);) | 184 DEF_BENCH(return new BlurRectBoxFilterBench(BIG);) |
| 186 DEF_BENCH(return new BlurRectBoxFilterBench(REALBIG);) | 185 DEF_BENCH(return new BlurRectBoxFilterBench(REALBIG);) |
| 187 DEF_BENCH(return new BlurRectBoxFilterBench(REAL);) | 186 DEF_BENCH(return new BlurRectBoxFilterBench(REAL);) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));) | 219 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));) |
| 221 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));) | 220 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));) |
| 222 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));) | 221 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));) |
| 223 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));) | 222 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));) |
| 224 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));) | 223 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));) |
| 225 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));) | 224 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));) |
| 226 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));) | 225 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));) |
| 227 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));) | 226 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));) |
| 228 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));) | 227 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));) |
| 229 #endif | 228 #endif |
| OLD | NEW |