Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Unified Diff: bench/BlurRectBench.cpp

Issue 23701006: Push sigma-based blur interface into our GMs/benches/tests/samplecode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleaned up Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/BlurBench.cpp ('k') | bench/RectoriBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « bench/BlurBench.cpp ('k') | bench/RectoriBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698