Index: bench/BlurRectBench.cpp |
=================================================================== |
--- bench/BlurRectBench.cpp (revision 11108) |
+++ bench/BlurRectBench.cpp (working copy) |
@@ -15,7 +15,9 @@ |
#define SMALL SkIntToScalar(2) |
#define REAL SkFloatToScalar(1.5f) |
+static const SkScalar kMedium = SkIntToScalar(5); |
#define BIG SkIntToScalar(10) |
+static const SkScalar kMedBig = SkIntToScalar(20); |
#define REALBIG SkFloatToScalar(30.5f) |
class BlurRectBench: public SkBenchmark { |
@@ -83,12 +85,13 @@ |
name.printf("blurrect_direct_%d", SkScalarRoundToInt(rad)); |
} |
- setName(name); |
+ this->setName(name); |
} |
protected: |
virtual void makeBlurryRect(const SkRect& r) SK_OVERRIDE { |
SkMask mask; |
- SkBlurMask::BlurRect(&mask, r, this->radius(), SkBlurMask::kNormal_Style); |
+ SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()), |
+ &mask, r, SkBlurMask::kNormal_Style); |
SkMask::FreeImage(mask.fImage); |
} |
private: |
@@ -127,12 +130,14 @@ |
public: |
BlurRectBoxFilterBench(void *param, SkScalar rad) : INHERITED(param, rad) { |
SkString name; |
+ |
if (SkScalarFraction(rad) != 0) { |
name.printf("blurrect_boxfilter_%.2f", SkScalarToFloat(rad)); |
} else { |
name.printf("blurrect_boxfilter_%d", SkScalarRoundToInt(rad)); |
} |
- setName(name); |
+ |
+ this->setName(name); |
} |
protected: |
@@ -140,9 +145,9 @@ |
virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { |
SkMask mask; |
mask.fImage = NULL; |
- SkBlurMask::Blur(&mask, fSrcMask, this->radius(), |
- SkBlurMask::kNormal_Style, |
- SkBlurMask::kHigh_Quality); |
+ SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()), |
+ SkBlurMask::kNormal_Style, |
+ SkBlurMask::kHigh_Quality); |
SkMask::FreeImage(mask.fImage); |
} |
private: |
@@ -153,12 +158,14 @@ |
public: |
BlurRectGaussianBench(void *param, SkScalar rad) : INHERITED(param, rad) { |
SkString name; |
+ |
if (SkScalarFraction(rad) != 0) { |
name.printf("blurrect_gaussian_%.2f", SkScalarToFloat(rad)); |
} else { |
name.printf("blurrect_gaussian_%d", SkScalarRoundToInt(rad)); |
} |
- setName(name); |
+ |
+ this->setName(name); |
} |
protected: |
@@ -166,8 +173,8 @@ |
virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { |
SkMask mask; |
mask.fImage = NULL; |
- SkBlurMask::BlurGroundTruth(&mask, fSrcMask, this->radius(), |
- SkBlurMask::kNormal_Style); |
+ SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()), |
+ &mask, fSrcMask, SkBlurMask::kNormal_Style); |
SkMask::FreeImage(mask.fImage); |
} |
private: |
@@ -187,11 +194,11 @@ |
DEF_BENCH(return new BlurRectDirectBench(p, REALBIG);) |
DEF_BENCH(return new BlurRectDirectBench(p, REAL);) |
-DEF_BENCH(return new BlurRectDirectBench(p, SkIntToScalar(5));) |
-DEF_BENCH(return new BlurRectDirectBench(p, SkIntToScalar(20));) |
+DEF_BENCH(return new BlurRectDirectBench(p, kMedium);) |
+DEF_BENCH(return new BlurRectDirectBench(p, kMedBig);) |
-DEF_BENCH(return new BlurRectBoxFilterBench(p, SkIntToScalar(5));) |
-DEF_BENCH(return new BlurRectBoxFilterBench(p, SkIntToScalar(20));) |
+DEF_BENCH(return new BlurRectBoxFilterBench(p, kMedium);) |
+DEF_BENCH(return new BlurRectBoxFilterBench(p, kMedBig);) |
#if 0 |
// disable Gaussian benchmarks; the algorithm works well enough |