move common blur types into central header
BUG=skia:
R=scroggo@google.com, djsollen@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/253833002
git-svn-id: http://skia.googlecode.com/svn/trunk@14411 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/BlurBench.cpp b/bench/BlurBench.cpp
index e7811d6..ae31804 100644
--- a/bench/BlurBench.cpp
+++ b/bench/BlurBench.cpp
@@ -28,12 +28,12 @@
class BlurBench : public SkBenchmark {
SkScalar fRadius;
- SkBlurMaskFilter::BlurStyle fStyle;
- uint32_t fFlags;
+ SkBlurStyle fStyle;
+ uint32_t fFlags;
SkString fName;
public:
- BlurBench(SkScalar rad, SkBlurMaskFilter::BlurStyle bs, uint32_t flags = 0) {
+ BlurBench(SkScalar rad, SkBlurStyle bs, uint32_t flags = 0) {
fRadius = rad;
fStyle = bs;
fFlags = flags;
@@ -78,32 +78,32 @@
typedef SkBenchmark INHERITED;
};
-DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kNormal_BlurStyle);)
-DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kSolid_BlurStyle);)
-DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kOuter_BlurStyle);)
-DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kInner_BlurStyle);)
+DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(SMALL, kSolid_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(SMALL, kOuter_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(SMALL, kInner_SkBlurStyle);)
-DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kNormal_BlurStyle);)
-DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kSolid_BlurStyle);)
-DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kOuter_BlurStyle);)
-DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kInner_BlurStyle);)
+DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(BIG, kSolid_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(BIG, kOuter_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(BIG, kInner_SkBlurStyle);)
-DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kNormal_BlurStyle);)
-DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kSolid_BlurStyle);)
-DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kOuter_BlurStyle);)
-DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kInner_BlurStyle);)
+DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(REALBIG, kSolid_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(REALBIG, kOuter_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(REALBIG, kInner_SkBlurStyle);)
-DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kNormal_BlurStyle);)
-DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kSolid_BlurStyle);)
-DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kOuter_BlurStyle);)
-DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kInner_BlurStyle);)
+DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(REAL, kSolid_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(REAL, kOuter_SkBlurStyle);)
+DEF_BENCH(return new BlurBench(REAL, kInner_SkBlurStyle);)
-DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
+DEF_BENCH(return new BlurBench(SMALL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
-DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
+DEF_BENCH(return new BlurBench(BIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
-DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
+DEF_BENCH(return new BlurBench(REALBIG, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
-DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
+DEF_BENCH(return new BlurBench(REAL, kNormal_SkBlurStyle, SkBlurMaskFilter::kHighQuality_BlurFlag);)
-DEF_BENCH(return new BlurBench(0, SkBlurMaskFilter::kNormal_BlurStyle);)
+DEF_BENCH(return new BlurBench(0, kNormal_SkBlurStyle);)
diff --git a/bench/BlurRectBench.cpp b/bench/BlurRectBench.cpp
index d4876ce..6871e0e 100644
--- a/bench/BlurRectBench.cpp
+++ b/bench/BlurRectBench.cpp
@@ -91,7 +91,7 @@
virtual void makeBlurryRect(const SkRect& r) SK_OVERRIDE {
SkMask mask;
SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
- &mask, r, SkBlurMask::kNormal_Style);
+ &mask, r, kNormal_SkBlurStyle);
SkMask::FreeImage(mask.fImage);
}
private:
@@ -146,8 +146,7 @@
SkMask mask;
mask.fImage = NULL;
SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(this->radius()),
- SkBlurMask::kNormal_Style,
- SkBlurMask::kHigh_Quality);
+ kNormal_SkBlurStyle, kHigh_SkBlurQuality);
SkMask::FreeImage(mask.fImage);
}
private:
@@ -174,7 +173,7 @@
SkMask mask;
mask.fImage = NULL;
SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
- &mask, fSrcMask, SkBlurMask::kNormal_Style);
+ &mask, fSrcMask, kNormal_SkBlurStyle);
SkMask::FreeImage(mask.fImage);
}
private:
diff --git a/bench/BlurRoundRectBench.cpp b/bench/BlurRoundRectBench.cpp
index a3d0ba9..43391bf 100644
--- a/bench/BlurRoundRectBench.cpp
+++ b/bench/BlurRoundRectBench.cpp
@@ -50,7 +50,7 @@
info.fPostTranslate = false;
SkPaint* paint = looperBuilder.addLayerOnTop(info);
SkMaskFilter* maskFilter = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf),
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint->setMaskFilter(maskFilter)->unref();
diff --git a/bench/RectoriBench.cpp b/bench/RectoriBench.cpp
index 87f5fee..84af352 100644
--- a/bench/RectoriBench.cpp
+++ b/bench/RectoriBench.cpp
@@ -85,7 +85,7 @@
SkPaint* paint = looperBuilder.addLayer(info);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
sigma,
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint->setMaskFilter(mf)->unref();
diff --git a/gm/bigblurs.cpp b/gm/bigblurs.cpp
index b885f4f..7881114 100644
--- a/gm/bigblurs.cpp
+++ b/gm/bigblurs.cpp
@@ -69,9 +69,8 @@
int desiredX = 0, desiredY = 0;
for (int i = 0; i < 2; ++i) {
- for (int j = 0; j < SkBlurMaskFilter::kBlurStyleCount; ++j) {
- SkMaskFilter* mf = SkBlurMaskFilter::Create((SkBlurMaskFilter::BlurStyle)j,
- kSigma);
+ for (int j = 0; j <= kLastEnum_SkBlurStyle; ++j) {
+ SkMaskFilter* mf = SkBlurMaskFilter::Create((SkBlurStyle)j, kSigma);
blurPaint.setMaskFilter(mf)->unref();
for (int k = 0; k < (int)SK_ARRAY_COUNT(origins); ++k) {
@@ -107,7 +106,7 @@
private:
static const int kCloseUpSize = 64;
static const int kWidth = 5 * kCloseUpSize;
- static const int kHeight = 2 * SkBlurMaskFilter::kBlurStyleCount * kCloseUpSize;
+ static const int kHeight = 2 * (kLastEnum_SkBlurStyle + 1) * kCloseUpSize;
typedef GM INHERITED;
};
diff --git a/gm/bitmapmatrix.cpp b/gm/bitmapmatrix.cpp
index eec421f..e0b9199 100644
--- a/gm/bitmapmatrix.cpp
+++ b/gm/bitmapmatrix.cpp
@@ -84,7 +84,7 @@
paint.setFilterLevel(SkPaint::kLow_FilterLevel);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(5),
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
diff --git a/gm/bleed.cpp b/gm/bleed.cpp
index c343d84..426129b 100644
--- a/gm/bleed.cpp
+++ b/gm/bleed.cpp
@@ -162,7 +162,7 @@
SkPaint paint;
paint.setFilterLevel(filter);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)));
paint.setMaskFilter(mf)->unref();
diff --git a/gm/blurquickreject.cpp b/gm/blurquickreject.cpp
index 431f022..ae5b689 100644
--- a/gm/blurquickreject.cpp
+++ b/gm/blurquickreject.cpp
@@ -56,7 +56,7 @@
SkPaint blurPaint;
blurPaint.setFilterLevel(SkPaint::kLow_FilterLevel);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(kBlurRadius));
blurPaint.setMaskFilter(mf)->unref();
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp
index 52edd6a..bc5dbc8 100644
--- a/gm/blurrect.cpp
+++ b/gm/blurrect.cpp
@@ -58,7 +58,7 @@
typedef void (*PaintProc)(SkPaint*, SkScalar width);
class BlurRectGM : public skiagm::GM {
- SkAutoTUnref<SkMaskFilter> fMaskFilters[SkBlurMaskFilter::kBlurStyleCount];
+ SkAutoTUnref<SkMaskFilter> fMaskFilters[kLastEnum_SkBlurStyle + 1];
SkString fName;
SkAlpha fAlpha;
public:
@@ -69,8 +69,8 @@
protected:
virtual void onOnceBeforeDraw() SK_OVERRIDE {
- for (int i = 0; i < SkBlurMaskFilter::kBlurStyleCount; ++i) {
- fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurMaskFilter::BlurStyle) i,
+ for (int i = 0; i <= kLastEnum_SkBlurStyle; ++i) {
+ fMaskFilters[i].reset(SkBlurMaskFilter::Create((SkBlurStyle)i,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(STROKE_WIDTH/2)),
SkBlurMaskFilter::kHighQuality_BlurFlag));
}
@@ -143,11 +143,11 @@
SkString fName;
unsigned int fRectWidth, fRectHeight;
SkScalar fRadius;
- SkBlurMask::Style fStyle;
+ SkBlurStyle fStyle;
public:
BlurRectCompareGM(const char name[], unsigned int rectWidth,
unsigned int rectHeight, float radius,
- SkBlurMask::Style style)
+ SkBlurStyle style)
: fName(name)
, fRectWidth(rectWidth)
, fRectHeight(rectHeight)
@@ -163,7 +163,7 @@
SkScalar radius() const {
return fRadius;
}
- SkBlurMask::Style style() const {
+ SkBlurStyle style() const {
return fStyle;
}
@@ -215,7 +215,7 @@
public:
BlurRectFastGM(const char name[], unsigned int rectWidth,
unsigned int rectHeight, float blurRadius,
- SkBlurMask::Style style) :
+ SkBlurStyle style) :
INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
@@ -231,7 +231,7 @@
class BlurRectSlowGM: public BlurRectCompareGM {
public:
BlurRectSlowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
- float blurRadius, SkBlurMask::Style style)
+ float blurRadius, SkBlurStyle style)
: INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
@@ -252,8 +252,8 @@
this->style(), this->getQuality());
}
- virtual SkBlurMask::Quality getQuality() {
- return SkBlurMask::kHigh_Quality;
+ virtual SkBlurQuality getQuality() {
+ return kHigh_SkBlurQuality;
}
private:
typedef BlurRectCompareGM INHERITED;
@@ -262,13 +262,13 @@
class BlurRectSlowLowGM: public BlurRectSlowGM {
public:
BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
- float blurRadius, SkBlurMask::Style style)
+ float blurRadius, SkBlurStyle style)
: INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
protected:
- virtual SkBlurMask::Quality getQuality() SK_OVERRIDE {
- return SkBlurMask::kLow_Quality;
+ virtual SkBlurQuality getQuality() SK_OVERRIDE {
+ return kLow_SkBlurQuality;
}
private:
typedef BlurRectSlowGM INHERITED;
@@ -277,7 +277,7 @@
class BlurRectGroundTruthGM: public BlurRectCompareGM {
public:
BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
- float blurRadius, SkBlurMask::Style style)
+ float blurRadius, SkBlurStyle style)
: INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
@@ -297,8 +297,8 @@
m, src, this->style());
}
- virtual SkBlurMask::Quality getQuality() {
- return SkBlurMask::kHigh_Quality;
+ virtual SkBlurQuality getQuality() {
+ return kHigh_SkBlurQuality;
}
private:
typedef BlurRectCompareGM INHERITED;
@@ -314,48 +314,48 @@
// regular size rects, blurs should be small enough not to completely overlap.
-DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_normal_fast", 25, 100, kSmall, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_normal_fast", 25, 100, kBig, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_normal_slow", 25, 100, kSmall, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_normal_slow", 25, 100, kBig, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_inner_fast", 25, 100, kSmall, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_inner_fast", 25, 100, kBig, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_inner_slow", 25, 100, kSmall, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_inner_slow", 25, 100, kBig, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_outer_fast", 25, 100, kSmall, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_outer_fast", 25, 100, kBig, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_outer_slow", 25, 100, kSmall, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_outer_slow", 25, 100, kBig, SkBlurMask::kOuter_Style);)
+DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_normal_fast", 25, 100, kSmall, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_normal_fast", 25, 100, kBig, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_normal_slow", 25, 100, kSmall, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_normal_slow", 25, 100, kBig, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_inner_fast", 25, 100, kSmall, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_inner_fast", 25, 100, kBig, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_inner_slow", 25, 100, kSmall, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_inner_slow", 25, 100, kBig, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_outer_fast", 25, 100, kSmall, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_outer_fast", 25, 100, kBig, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_outer_slow", 25, 100, kSmall, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_outer_slow", 25, 100, kBig, kOuter_SkBlurStyle);)
// skinny tall rects, blurs overlap in X but not y
-DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_normal_fast", 5, 100, kSmall, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_normal_fast", 5, 100, kBig, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_normal_slow", 5, 100, kSmall, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_normal_slow", 5, 100, kBig, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_inner_fast", 5, 100, kSmall, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_inner_fast", 5, 100, kBig, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_inner_slow", 5, 100, kSmall, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_inner_slow", 5, 100, kBig, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_outer_fast", 5, 100, kSmall, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_outer_fast", 5, 100, kBig, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_outer_slow", 5, 100, kSmall, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_outer_slow", 5, 100, kBig, SkBlurMask::kOuter_Style);)
+DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_normal_fast", 5, 100, kSmall, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_normal_fast", 5, 100, kBig, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_normal_slow", 5, 100, kSmall, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_normal_slow", 5, 100, kBig, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_inner_fast", 5, 100, kSmall, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_inner_fast", 5, 100, kBig, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_inner_slow", 5, 100, kSmall, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_inner_slow", 5, 100, kBig, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_outer_fast", 5, 100, kSmall, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_outer_fast", 5, 100, kBig, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_outer_slow", 5, 100, kSmall, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_outer_slow", 5, 100, kBig, kOuter_SkBlurStyle);)
// tiny rects, blurs overlap in X and Y
-DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_normal_fast", 5, 5, kSmall, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_normal_fast", 5, 5, kBig, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_normal_slow", 5, 5, kSmall, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_normal_slow", 5, 5, kBig, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_inner_fast", 5, 5, kSmall, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_inner_fast", 5, 5, kBig, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_inner_slow", 5, 5, kSmall, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_inner_slow", 5, 5, kBig, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_outer_fast", 5, 5, kSmall, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_outer_fast", 5, 5, kBig, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_outer_slow", 5, 5, kSmall, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_outer_slow", 5, 5, kBig, SkBlurMask::kOuter_Style);)
+DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_normal_fast", 5, 5, kSmall, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_normal_fast", 5, 5, kBig, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_normal_slow", 5, 5, kSmall, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_normal_slow", 5, 5, kBig, kNormal_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_inner_fast", 5, 5, kSmall, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_inner_fast", 5, 5, kBig, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_inner_slow", 5, 5, kSmall, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_inner_slow", 5, 5, kBig, kInner_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_outer_fast", 5, 5, kSmall, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_outer_fast", 5, 5, kBig, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_outer_slow", 5, 5, kSmall, kOuter_SkBlurStyle);)
+DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_outer_slow", 5, 5, kBig, kOuter_SkBlurStyle);)
#if 0
diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp
index 08086ac..6221480 100644
--- a/gm/blurroundrect.cpp
+++ b/gm/blurroundrect.cpp
@@ -63,7 +63,7 @@
info.fPostTranslate = false;
SkPaint* paint = looperBuilder.addLayerOnTop(info);
SkMaskFilter* maskFilter = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf),
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint->setMaskFilter(maskFilter)->unref();
@@ -121,7 +121,7 @@
canvas->translate(0, (r.height() + SkIntToScalar(50)) * i);
for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) {
SkMaskFilter* filter = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i])),
SkBlurMaskFilter::kHighQuality_BlurFlag);
SkPaint paint;
diff --git a/gm/blurs.cpp b/gm/blurs.cpp
index c2a1c17..822d488 100644
--- a/gm/blurs.cpp
+++ b/gm/blurs.cpp
@@ -27,16 +27,16 @@
}
virtual void onDraw(SkCanvas* canvas) {
- SkBlurMaskFilter::BlurStyle NONE = SkBlurMaskFilter::BlurStyle(-999);
+ SkBlurStyle NONE = SkBlurStyle(-999);
static const struct {
- SkBlurMaskFilter::BlurStyle fStyle;
- int fCx, fCy;
+ SkBlurStyle fStyle;
+ int fCx, fCy;
} gRecs[] = {
- { NONE, 0, 0 },
- { SkBlurMaskFilter::kInner_BlurStyle, -1, 0 },
- { SkBlurMaskFilter::kNormal_BlurStyle, 0, 1 },
- { SkBlurMaskFilter::kSolid_BlurStyle, 0, -1 },
- { SkBlurMaskFilter::kOuter_BlurStyle, 1, 0 },
+ { NONE, 0, 0 },
+ { kInner_SkBlurStyle, -1, 0 },
+ { kNormal_SkBlurStyle, 0, 1 },
+ { kSolid_SkBlurStyle, 0, -1 },
+ { kOuter_SkBlurStyle, 1, 0 },
};
SkPaint paint;
@@ -64,7 +64,7 @@
}
// draw text
{
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)),
flags);
paint.setMaskFilter(mf)->unref();
diff --git a/gm/circles.cpp b/gm/circles.cpp
index ce833db..36cd8b0 100644
--- a/gm/circles.cpp
+++ b/gm/circles.cpp
@@ -52,7 +52,7 @@
SkPaint p;
p.setAntiAlias(true);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag);
p.setMaskFilter(mf)->unref();
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 3cc9026..bc7e035 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -163,7 +163,7 @@
srcRect.setXYWH(1, 1, 3, 3);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp
index d3a4475..67e280e 100644
--- a/gm/drawlooper.cpp
+++ b/gm/drawlooper.cpp
@@ -85,7 +85,7 @@
paint->setStyle(gParams[i].fStyle);
paint->setStrokeWidth(gParams[i].fWidth);
if (gParams[i].fBlur > 0) {
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(gParams[i].fBlur));
paint->setMaskFilter(mf)->unref();
}
diff --git a/gm/megalooper.cpp b/gm/megalooper.cpp
index e825550..ae92971 100644
--- a/gm/megalooper.cpp
+++ b/gm/megalooper.cpp
@@ -113,8 +113,7 @@
SkMaskFilter* createBlur() {
static const SkScalar kBlurSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(25));
- return SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
- kBlurSigma,
+ return SkBlurMaskFilter::Create(kNormal_SkBlurStyle, kBlurSigma,
SkBlurMaskFilter::kHighQuality_BlurFlag);
}
diff --git a/gm/rects.cpp b/gm/rects.cpp
index 9600dd5..4b12605 100644
--- a/gm/rects.cpp
+++ b/gm/rects.cpp
@@ -64,7 +64,7 @@
p.setColor(SK_ColorWHITE);
p.setAntiAlias(true);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag);
p.setMaskFilter(mf)->unref();
diff --git a/gm/skbug1719.cpp b/gm/skbug1719.cpp
index 01bb844..22caffd 100644
--- a/gm/skbug1719.cpp
+++ b/gm/skbug1719.cpp
@@ -80,7 +80,7 @@
paint.setAntiAlias(true);
paint.setColor(0xFF000000);
paint.setMaskFilter(
- SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
0.78867501f,
SkBlurMaskFilter::kHighQuality_BlurFlag))->unref();
paint.setColorFilter(
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp
index eb7accb..7e6bee4 100644
--- a/gm/texteffects.cpp
+++ b/gm/texteffects.cpp
@@ -13,7 +13,7 @@
#include "SkLayerRasterizer.h"
static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
- p.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ p.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref();
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index ed30245..77dd925 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -307,6 +307,7 @@
'SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES',
'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
'SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS',
+ 'SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE',
# Needed until we fix skbug.com/2440.
'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
# Transitional, for deprecated SkCanvas::SaveFlags methods.
diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi
index eeac1f6..1ec908e 100644
--- a/gyp/skia_for_chromium_defines.gypi
+++ b/gyp/skia_for_chromium_defines.gypi
@@ -21,6 +21,7 @@
'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
'SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD',
'SK_SUPPORT_DEPRECATED_RECORD_FLAGS',
+ 'SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE',
],
},
}
diff --git a/include/core/SkBlurTypes.h b/include/core/SkBlurTypes.h
new file mode 100644
index 0000000..afbec19
--- /dev/null
+++ b/include/core/SkBlurTypes.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkBlurTypes_DEFINED
+#define SkBlurTypes_DEFINED
+
+#include "SkTypes.h"
+
+enum SkBlurStyle {
+ kNormal_SkBlurStyle, //!< fuzzy inside and outside
+ kSolid_SkBlurStyle, //!< solid inside, fuzzy outside
+ kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside
+ kInner_SkBlurStyle, //!< fuzzy inside, nothing outside
+
+ kLastEnum_SkBlurStyle = kInner_SkBlurStyle
+};
+
+enum SkBlurQuality {
+ kLow_SkBlurQuality, //!< e.g. box filter
+ kHigh_SkBlurQuality, //!< e.g. 3-pass similar to gaussian
+
+ kLastEnum_SkBlurQuality
+};
+
+#endif
diff --git a/include/effects/SkBlurMaskFilter.h b/include/effects/SkBlurMaskFilter.h
index 9b352dc..ddb163e 100644
--- a/include/effects/SkBlurMaskFilter.h
+++ b/include/effects/SkBlurMaskFilter.h
@@ -11,17 +11,20 @@
// we include this since our callers will need to at least be able to ref/unref
#include "SkMaskFilter.h"
#include "SkScalar.h"
+#include "SkBlurTypes.h"
class SK_API SkBlurMaskFilter {
public:
+#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
enum BlurStyle {
- kNormal_BlurStyle, //!< fuzzy inside and outside
- kSolid_BlurStyle, //!< solid inside, fuzzy outside
- kOuter_BlurStyle, //!< nothing inside, fuzzy outside
- kInner_BlurStyle, //!< fuzzy inside, nothing outside
+ kNormal_BlurStyle = kNormal_SkBlurStyle, //!< fuzzy inside and outside
+ kSolid_BlurStyle = kSolid_SkBlurStyle, //!< solid inside, fuzzy outside
+ kOuter_BlurStyle = kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside
+ kInner_BlurStyle = kInner_SkBlurStyle, //!< fuzzy inside, nothing outside
kBlurStyleCount
};
+#endif
enum BlurFlags {
kNone_BlurFlag = 0x00,
@@ -33,6 +36,7 @@
kAll_BlurFlag = 0x03
};
+#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
SK_ATTR_DEPRECATED("use sigma version")
static SkMaskFilter* Create(SkScalar radius, BlurStyle style,
uint32_t flags = kNone_BlurFlag);
@@ -45,6 +49,15 @@
*/
static SkMaskFilter* Create(BlurStyle style, SkScalar sigma,
uint32_t flags = kNone_BlurFlag);
+#endif
+
+ /** Create a blur maskfilter.
+ * @param style The SkBlurStyle to use
+ * @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
+ * @param flags Flags to use - defaults to none
+ * @return The new blur maskfilter
+ */
+ static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flags = kNone_BlurFlag);
/** Create an emboss maskfilter
@param blurSigma standard deviation of the Gaussian blur to apply
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 35eeaba..96dcdae 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -82,7 +82,7 @@
///////////////////////////////////////////////////////////
static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) {
- p.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ p.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)),
SkBlurMaskFilter::kNone_BlurFlag))->unref();
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
diff --git a/samplecode/SampleAnimBlur.cpp b/samplecode/SampleAnimBlur.cpp
index 5d6638a..e00c46d 100644
--- a/samplecode/SampleAnimBlur.cpp
+++ b/samplecode/SampleAnimBlur.cpp
@@ -37,11 +37,11 @@
25 * SK_Scalar1,
3 * SK_Scalar1);
- static const SkBlurMaskFilter::BlurStyle gStyles[] = {
- SkBlurMaskFilter::kNormal_BlurStyle,
- SkBlurMaskFilter::kInner_BlurStyle,
- SkBlurMaskFilter::kSolid_BlurStyle,
- SkBlurMaskFilter::kOuter_BlurStyle,
+ static const SkBlurStyle gStyles[] = {
+ kNormal_SkBlurStyle,
+ kInner_SkBlurStyle,
+ kSolid_SkBlurStyle,
+ kOuter_SkBlurStyle,
};
SkRandom random;
diff --git a/samplecode/SampleBigBlur.cpp b/samplecode/SampleBigBlur.cpp
index 928fc6f..fcbd6ac 100644
--- a/samplecode/SampleBigBlur.cpp
+++ b/samplecode/SampleBigBlur.cpp
@@ -31,7 +31,7 @@
canvas->save();
paint.setColor(SK_ColorBLUE);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(128)),
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint.setMaskFilter(mf)->unref();
diff --git a/samplecode/SampleBlur.cpp b/samplecode/SampleBlur.cpp
index a918bf2..7607dfc 100644
--- a/samplecode/SampleBlur.cpp
+++ b/samplecode/SampleBlur.cpp
@@ -76,16 +76,16 @@
virtual void onDrawContent(SkCanvas* canvas) {
drawBG(canvas);
- SkBlurMaskFilter::BlurStyle NONE = SkBlurMaskFilter::BlurStyle(-999);
+ SkBlurStyle NONE = SkBlurStyle(-999);
static const struct {
- SkBlurMaskFilter::BlurStyle fStyle;
- int fCx, fCy;
+ SkBlurStyle fStyle;
+ int fCx, fCy;
} gRecs[] = {
{ NONE, 0, 0 },
- { SkBlurMaskFilter::kInner_BlurStyle, -1, 0 },
- { SkBlurMaskFilter::kNormal_BlurStyle, 0, 1 },
- { SkBlurMaskFilter::kSolid_BlurStyle, 0, -1 },
- { SkBlurMaskFilter::kOuter_BlurStyle, 1, 0 },
+ { kInner_SkBlurStyle, -1, 0 },
+ { kNormal_SkBlurStyle, 0, 1 },
+ { kSolid_SkBlurStyle, 0, -1 },
+ { kOuter_SkBlurStyle, 1, 0 },
};
SkPaint paint;
@@ -111,7 +111,7 @@
}
// draw text
{
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)),
flags);
paint.setMaskFilter(mf)->unref();
diff --git a/samplecode/SampleEffects.cpp b/samplecode/SampleEffects.cpp
index cbefae8..01a63ad 100644
--- a/samplecode/SampleEffects.cpp
+++ b/samplecode/SampleEffects.cpp
@@ -24,7 +24,7 @@
static void paint_proc1(SkPaint* paint) {
paint->setMaskFilter(SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(2))))->unref();
}
diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp
index e66f086..e690df1 100644
--- a/samplecode/SampleFuzz.cpp
+++ b/samplecode/SampleFuzz.cpp
@@ -190,9 +190,8 @@
case 7:
if (quick == true) break;
- SkSafeUnref(paint.setMaskFilter(SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
- make_number())));
+ SkSafeUnref(paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
+ make_number())));
break;
case 8:
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index ece9684..d828ae6 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -478,7 +478,7 @@
static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p)
{
- p.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ p.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref();
rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
diff --git a/samplecode/SampleStrokePath.cpp b/samplecode/SampleStrokePath.cpp
index ce6a010..4526512 100644
--- a/samplecode/SampleStrokePath.cpp
+++ b/samplecode/SampleStrokePath.cpp
@@ -160,11 +160,11 @@
paint.setColor(SK_ColorWHITE);
canvas->translate(10, 30);
- static const SkBlurMaskFilter::BlurStyle gStyle[] = {
- SkBlurMaskFilter::kNormal_BlurStyle,
- SkBlurMaskFilter::kInner_BlurStyle,
- SkBlurMaskFilter::kOuter_BlurStyle,
- SkBlurMaskFilter::kSolid_BlurStyle,
+ static const SkBlurStyle gStyle[] = {
+ kNormal_SkBlurStyle,
+ kInner_SkBlurStyle,
+ kOuter_SkBlurStyle,
+ kSolid_SkBlurStyle,
};
for (int x = 0; x < 5; x++) {
SkMaskFilter* mf;
diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp
index 2732452..fcef92f 100644
--- a/samplecode/SampleTextAlpha.cpp
+++ b/samplecode/SampleTextAlpha.cpp
@@ -70,7 +70,7 @@
paint.setARGB(fByte, 0xFF, 0xFF, 0xFF);
- paint.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))));
paint.getMaskFilter()->unref();
diff --git a/samplecode/SampleTextureDomain.cpp b/samplecode/SampleTextureDomain.cpp
index 47a3ab0..926c559 100644
--- a/samplecode/SampleTextureDomain.cpp
+++ b/samplecode/SampleTextureDomain.cpp
@@ -78,7 +78,7 @@
srcRect.setXYWH(1, 1, 3, 3);
dstRect.setXYWH(5, 405, 305, 305);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkBlurMaskFilter::kNormal_BlurStyle,
+ kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
@@ -90,7 +90,7 @@
// but it will test a code path in SkGpuDevice::drawBitmap
// that handles blurs with rects transformed to non-
// orthogonal rects. It also tests the NULL src rect handling
- mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(5),
SkBlurMaskFilter::kHighQuality_BlurFlag);
paint.setMaskFilter(mf)->unref();
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index de75d05..620de54 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -46,7 +46,7 @@
void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha,
SkScalar x, SkScalar y) {
SkPaint p;
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kNone_BlurFlag);
p.setMaskFilter(mf)->unref();
diff --git a/src/animator/SkDrawBlur.cpp b/src/animator/SkDrawBlur.cpp
index 5f388c9..36d6452 100644
--- a/src/animator/SkDrawBlur.cpp
+++ b/src/animator/SkDrawBlur.cpp
@@ -22,11 +22,12 @@
SkDrawBlur::SkDrawBlur()
: fSigma(-1)
- , fBlurStyle(SkBlurMaskFilter::kNormal_BlurStyle) {
+ , fBlurStyle(kNormal_SkBlurStyle) {
}
SkMaskFilter* SkDrawBlur::getMaskFilter() {
- if (fSigma < 0)
+ if (fSigma <= 0) {
return NULL;
- return SkBlurMaskFilter::Create((SkBlurMaskFilter::BlurStyle) fBlurStyle, fSigma);
+ }
+ return SkBlurMaskFilter::Create((SkBlurStyle)fBlurStyle, fSigma);
}
diff --git a/src/animator/SkDrawBlur.h b/src/animator/SkDrawBlur.h
index 462a041..7507592 100644
--- a/src/animator/SkDrawBlur.h
+++ b/src/animator/SkDrawBlur.h
@@ -17,7 +17,7 @@
virtual SkMaskFilter* getMaskFilter() SK_OVERRIDE;
protected:
SkScalar fSigma;
- int /*SkBlurMaskFilter::BlurStyle*/ fBlurStyle;
+ int /*SkBlurStyle*/ fBlurStyle;
typedef SkDrawMaskFilter INHERITED;
};
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index 7850669..03e635b 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -46,9 +46,7 @@
SkBlurMaskFilter::kHighQuality_BlurFlag :
SkBlurMaskFilter::kNone_BlurFlag;
- fBlur = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
- sigma,
- blurFlags);
+ fBlur = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, sigma, blurFlags);
} else {
fBlur = NULL;
}
diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp
index f33817a..51604cd 100644
--- a/src/effects/SkBlurMask.cpp
+++ b/src/effects/SkBlurMask.cpp
@@ -435,11 +435,11 @@
static void clamp_with_orig(uint8_t dst[], int dstRowBytes,
const uint8_t src[], int srcRowBytes,
int sw, int sh,
- SkBlurMask::Style style) {
+ SkBlurStyle style) {
int x;
while (--sh >= 0) {
switch (style) {
- case SkBlurMask::kSolid_Style:
+ case kSolid_SkBlurStyle:
for (x = sw - 1; x >= 0; --x) {
int s = *src;
int d = *dst;
@@ -448,7 +448,7 @@
src += 1;
}
break;
- case SkBlurMask::kOuter_Style:
+ case kOuter_SkBlurStyle:
for (x = sw - 1; x >= 0; --x) {
if (*src) {
*dst = SkToU8(SkAlphaMul(*dst, SkAlpha255To256(255 - *src)));
@@ -475,21 +475,19 @@
SkMask::FreeImage(image);
}
-bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src,
- SkScalar sigma, Style style, Quality quality,
- SkIPoint* margin, bool force_quality) {
-
+bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, SkScalar sigma, SkBlurStyle style,
+ SkBlurQuality quality, SkIPoint* margin, bool force_quality) {
if (src.fFormat != SkMask::kA8_Format) {
return false;
}
// Force high quality off for small radii (performance)
if (!force_quality && sigma <= SkIntToScalar(2)) {
- quality = kLow_Quality;
+ quality = kLow_SkBlurQuality;
}
SkScalar passRadius;
- if (kHigh_Quality == quality) {
+ if (kHigh_SkBlurQuality == quality) {
// For the high quality path the 3 pass box blur kernel width is
// 6*rad+1 while the full Gaussian width is 6*sigma.
passRadius = sigma - (1/6.0f);
@@ -502,7 +500,7 @@
// highQuality: use three box blur passes as a cheap way
// to approximate a Gaussian blur
- int passCount = (kHigh_Quality == quality) ? 3 : 1;
+ int passCount = (kHigh_SkBlurQuality == quality) ? 3 : 1;
int rx = SkScalarCeilToInt(passRadius);
int outerWeight = 255 - SkScalarRoundToInt((SkIntToScalar(rx) - passRadius) * 255);
@@ -548,7 +546,7 @@
if (outerWeight == 255) {
int loRadius, hiRadius;
get_adjusted_radii(passRadius, &loRadius, &hiRadius);
- if (kHigh_Quality == quality) {
+ if (kHigh_SkBlurQuality == quality) {
// Do three X blurs, with a transpose on the final one.
w = boxBlur(sp, src.fRowBytes, tp, loRadius, hiRadius, w, h, false);
w = boxBlur(tp, w, dp, hiRadius, loRadius, w, h, false);
@@ -562,7 +560,7 @@
h = boxBlur(tp, h, dp, ry, ry, h, w, true);
}
} else {
- if (kHigh_Quality == quality) {
+ if (kHigh_SkBlurQuality == quality) {
// Do three X blurs, with a transpose on the final one.
w = boxBlurInterp(sp, src.fRowBytes, tp, rx, w, h, false, outerWeight);
w = boxBlurInterp(tp, w, dp, rx, w, h, false, outerWeight);
@@ -580,7 +578,7 @@
dst->fImage = dp;
// if need be, alloc the "real" dst (same size as src) and copy/merge
// the blur into it (applying the src)
- if (style == kInner_Style) {
+ if (style == kInner_SkBlurStyle) {
// now we allocate the "real" dst, mirror the size of src
size_t srcSize = src.computeImageSize();
if (0 == srcSize) {
@@ -592,14 +590,14 @@
dp + passCount * (rx + ry * dst->fRowBytes),
dst->fRowBytes, sw, sh);
SkMask::FreeImage(dp);
- } else if (style != kNormal_Style) {
+ } else if (style != kNormal_SkBlurStyle) {
clamp_with_orig(dp + passCount * (rx + ry * dst->fRowBytes),
dst->fRowBytes, sp, src.fRowBytes, sw, sh, style);
}
(void)autoCall.detach();
}
- if (style == kInner_Style) {
+ if (style == kInner_SkBlurStyle) {
dst->fBounds = src.fBounds; // restore trimmed bounds
dst->fRowBytes = src.fRowBytes;
}
@@ -734,7 +732,7 @@
}
bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst,
- const SkRect &src, Style style,
+ const SkRect &src, SkBlurStyle style,
SkIPoint *margin, SkMask::CreateMode createMode) {
int profile_size = SkScalarCeilToInt(6*sigma);
@@ -756,7 +754,7 @@
int sh = SkScalarFloorToInt(src.height());
if (createMode == SkMask::kJustComputeBounds_CreateMode) {
- if (style == kInner_Style) {
+ if (style == kInner_SkBlurStyle) {
dst->fBounds.set(SkScalarRoundToInt(src.fLeft),
SkScalarRoundToInt(src.fTop),
SkScalarRoundToInt(src.fRight),
@@ -797,7 +795,7 @@
}
}
- if (style == kInner_Style) {
+ if (style == kInner_SkBlurStyle) {
// now we allocate the "real" dst, mirror the size of src
size_t srcSize = (size_t)(src.width() * src.height());
if (0 == srcSize) {
@@ -817,12 +815,12 @@
SkScalarRoundToInt(src.fBottom)); // restore trimmed bounds
dst->fRowBytes = sw;
- } else if (style == kOuter_Style) {
+ } else if (style == kOuter_SkBlurStyle) {
for (int y = pad ; y < dstHeight-pad ; y++) {
uint8_t *dst_scanline = dp + y*dstWidth + pad;
memset(dst_scanline, 0, sw);
}
- } else if (style == kSolid_Style) {
+ } else if (style == kSolid_SkBlurStyle) {
for (int y = pad ; y < dstHeight-pad ; y++) {
uint8_t *dst_scanline = dp + y*dstWidth + pad;
memset(dst_scanline, 0xff, sw);
@@ -835,7 +833,7 @@
}
bool SkBlurMask::BlurRRect(SkScalar sigma, SkMask *dst,
- const SkRRect &src, Style style,
+ const SkRRect &src, SkBlurStyle style,
SkIPoint *margin, SkMask::CreateMode createMode) {
// Temporary for now -- always fail, should cause caller to fall back
// to old path. Plumbing just to land API and parallelize effort.
@@ -848,7 +846,7 @@
// useful for correctness comparisons.
bool SkBlurMask::BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
- Style style, SkIPoint* margin) {
+ SkBlurStyle style, SkIPoint* margin) {
if (src.fFormat != SkMask::kA8_Format) {
return false;
@@ -964,7 +962,7 @@
dst->fImage = dstPixels;
// if need be, alloc the "real" dst (same size as src) and copy/merge
// the blur into it (applying the src)
- if (style == kInner_Style) {
+ if (style == kInner_SkBlurStyle) {
// now we allocate the "real" dst, mirror the size of src
size_t srcSize = src.computeImageSize();
if (0 == srcSize) {
@@ -976,14 +974,14 @@
dstPixels + pad*dst->fRowBytes + pad,
dst->fRowBytes, srcWidth, srcHeight);
SkMask::FreeImage(dstPixels);
- } else if (style != kNormal_Style) {
+ } else if (style != kNormal_SkBlurStyle) {
clamp_with_orig(dstPixels + pad*dst->fRowBytes + pad,
dst->fRowBytes, srcPixels, src.fRowBytes, srcWidth, srcHeight, style);
}
(void)autoCall.detach();
}
- if (style == kInner_Style) {
+ if (style == kInner_SkBlurStyle) {
dst->fBounds = src.fBounds; // restore trimmed bounds
dst->fRowBytes = src.fRowBytes;
}
diff --git a/src/effects/SkBlurMask.h b/src/effects/SkBlurMask.h
index d4cd3d1..1600960 100644
--- a/src/effects/SkBlurMask.h
+++ b/src/effects/SkBlurMask.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,37 +5,21 @@
* found in the LICENSE file.
*/
-
#ifndef SkBlurMask_DEFINED
#define SkBlurMask_DEFINED
+#include "SkBlurTypes.h"
#include "SkShader.h"
#include "SkMask.h"
#include "SkRRect.h"
class SkBlurMask {
public:
- enum Style {
- kNormal_Style, //!< fuzzy inside and outside
- kSolid_Style, //!< solid inside, fuzzy outside
- kOuter_Style, //!< nothing inside, fuzzy outside
- kInner_Style, //!< fuzzy inside, nothing outside
-
- kStyleCount
- };
-
- enum Quality {
- kLow_Quality, //!< box blur
- kHigh_Quality //!< three pass box blur (similar to gaussian)
- };
-
- static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src,
- Style style,
+ static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src, SkBlurStyle,
SkIPoint *margin = NULL,
SkMask::CreateMode createMode =
SkMask::kComputeBoundsAndRenderImage_CreateMode);
- static bool BlurRRect(SkScalar sigma, SkMask *dst, const SkRRect &src,
- Style style,
+ static bool BlurRRect(SkScalar sigma, SkMask *dst, const SkRRect &src, SkBlurStyle,
SkIPoint *margin = NULL,
SkMask::CreateMode createMode =
SkMask::kComputeBoundsAndRenderImage_CreateMode);
@@ -48,13 +31,12 @@
// rectangle will lie.
static bool BoxBlur(SkMask* dst, const SkMask& src,
- SkScalar sigma, Style style, Quality quality,
+ SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
SkIPoint* margin = NULL, bool forceQuality = false);
// the "ground truth" blur does a gaussian convolution; it's slow
// but useful for comparison purposes.
- static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
- Style style,
+ static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src, SkBlurStyle,
SkIPoint* margin = NULL);
static SkScalar ConvertRadiusToSigma(SkScalar radius);
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 9f8935a..c4069ca 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -30,7 +30,7 @@
class SkBlurMaskFilterImpl : public SkMaskFilter {
public:
- SkBlurMaskFilterImpl(SkScalar sigma, SkBlurMaskFilter::BlurStyle, uint32_t flags);
+ SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle, uint32_t flags);
// overrides from SkMaskFilter
virtual SkMask::Format getFormat() const SK_OVERRIDE;
@@ -83,9 +83,9 @@
// a request like 10,000)
static const SkScalar kMAX_BLUR_SIGMA;
- SkScalar fSigma;
- SkBlurMaskFilter::BlurStyle fBlurStyle;
- uint32_t fBlurFlags;
+ SkScalar fSigma;
+ SkBlurStyle fBlurStyle;
+ uint32_t fBlurFlags;
SkBlurMaskFilterImpl(SkReadBuffer&);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
@@ -102,50 +102,42 @@
const SkScalar SkBlurMaskFilterImpl::kMAX_BLUR_SIGMA = SkIntToScalar(128);
+SkMaskFilter* SkBlurMaskFilter::Create(SkBlurStyle style, SkScalar sigma, uint32_t flags) {
+ if (!SkScalarIsFinite(sigma) || sigma <= 0) {
+ return NULL;
+ }
+ if ((unsigned)style > (unsigned)kLastEnum_SkBlurStyle) {
+ return NULL;
+ }
+ if (flags > SkBlurMaskFilter::kAll_BlurFlag) {
+ return NULL;
+ }
+ return SkNEW_ARGS(SkBlurMaskFilterImpl, (sigma, style, flags));
+}
+
+#ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
SkMaskFilter* SkBlurMaskFilter::Create(SkScalar radius,
SkBlurMaskFilter::BlurStyle style,
uint32_t flags) {
- // use !(radius > 0) instead of radius <= 0 to reject NaN values
- if (!(radius > 0) || (unsigned)style >= SkBlurMaskFilter::kBlurStyleCount
- || flags > SkBlurMaskFilter::kAll_BlurFlag) {
- return NULL;
- }
-
SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(radius);
-
- return SkNEW_ARGS(SkBlurMaskFilterImpl, (sigma, style, flags));
+ return Create((SkBlurStyle)style, sigma, flags);
}
SkMaskFilter* SkBlurMaskFilter::Create(SkBlurMaskFilter::BlurStyle style,
SkScalar sigma,
uint32_t flags) {
- // use !(sigma > 0) instead of sigma <= 0 to reject NaN values
- if (!(sigma > 0) || (unsigned)style >= SkBlurMaskFilter::kBlurStyleCount
- || flags > SkBlurMaskFilter::kAll_BlurFlag) {
- return NULL;
- }
-
- return SkNEW_ARGS(SkBlurMaskFilterImpl, (sigma, style, flags));
+ return Create((SkBlurStyle)style, sigma, flags);
}
+#endif
///////////////////////////////////////////////////////////////////////////////
-SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkScalar sigma,
- SkBlurMaskFilter::BlurStyle style,
- uint32_t flags)
- : fSigma(sigma), fBlurStyle(style), fBlurFlags(flags) {
-#if 0
- fGamma = NULL;
- if (gammaScale) {
- fGamma = new U8[256];
- if (gammaScale > 0)
- SkBlurMask::BuildSqrGamma(fGamma, gammaScale);
- else
- SkBlurMask::BuildSqrtGamma(fGamma, -gammaScale);
- }
-#endif
- SkASSERT(fSigma >= 0);
- SkASSERT((unsigned)style < SkBlurMaskFilter::kBlurStyleCount);
+SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle style, uint32_t flags)
+ : fSigma(sigma)
+ , fBlurStyle(style)
+ , fBlurFlags(flags) {
+ SkASSERT(fSigma > 0);
+ SkASSERT((unsigned)style <= kLastEnum_SkBlurStyle);
SkASSERT(flags <= SkBlurMaskFilter::kAll_BlurFlag);
}
@@ -158,12 +150,11 @@
SkIPoint* margin) const{
SkScalar sigma = this->computeXformedSigma(matrix);
- SkBlurMask::Quality blurQuality =
+ SkBlurQuality blurQuality =
(fBlurFlags & SkBlurMaskFilter::kHighQuality_BlurFlag) ?
- SkBlurMask::kHigh_Quality : SkBlurMask::kLow_Quality;
+ kHigh_SkBlurQuality : kLow_SkBlurQuality;
- return SkBlurMask::BoxBlur(dst, src, sigma, (SkBlurMask::Style)fBlurStyle,
- blurQuality, margin);
+ return SkBlurMask::BoxBlur(dst, src, sigma, fBlurStyle, blurQuality, margin);
}
bool SkBlurMaskFilterImpl::filterRectMask(SkMask* dst, const SkRect& r,
@@ -171,7 +162,7 @@
SkIPoint* margin, SkMask::CreateMode createMode) const{
SkScalar sigma = computeXformedSigma(matrix);
- return SkBlurMask::BlurRect(sigma, dst, r, (SkBlurMask::Style)fBlurStyle,
+ return SkBlurMask::BlurRect(sigma, dst, r, fBlurStyle,
margin, createMode);
}
@@ -180,7 +171,7 @@
SkIPoint* margin, SkMask::CreateMode createMode) const{
SkScalar sigma = computeXformedSigma(matrix);
- return SkBlurMask::BlurRRect(sigma, dst, r, (SkBlurMask::Style)fBlurStyle,
+ return SkBlurMask::BlurRRect(sigma, dst, r, fBlurStyle,
margin, createMode);
}
@@ -298,7 +289,7 @@
// TODO: report correct metrics for innerstyle, where we do not grow the
// total bounds, but we do need an inset the size of our blur-radius
- if (SkBlurMaskFilter::kInner_BlurStyle == fBlurStyle) {
+ if (kInner_SkBlurStyle == fBlurStyle) {
return kUnimplemented_FilterReturn;
}
@@ -410,8 +401,7 @@
// TODO: report correct metrics for innerstyle, where we do not grow the
// total bounds, but we do need an inset the size of our blur-radius
- if (SkBlurMaskFilter::kInner_BlurStyle == fBlurStyle ||
- SkBlurMaskFilter::kOuter_BlurStyle == fBlurStyle) {
+ if (kInner_SkBlurStyle == fBlurStyle || kOuter_SkBlurStyle == fBlurStyle) {
return kUnimplemented_FilterReturn;
}
@@ -531,10 +521,10 @@
SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkReadBuffer& buffer)
: SkMaskFilter(buffer) {
fSigma = buffer.readScalar();
- fBlurStyle = (SkBlurMaskFilter::BlurStyle)buffer.readInt();
+ fBlurStyle = (SkBlurStyle)buffer.readInt();
fBlurFlags = buffer.readUInt() & SkBlurMaskFilter::kAll_BlurFlag;
- SkASSERT(fSigma >= 0);
- SkASSERT((unsigned)fBlurStyle < SkBlurMaskFilter::kBlurStyleCount);
+ SkASSERT(fSigma > 0);
+ SkASSERT((unsigned)fBlurStyle <= kLastEnum_SkBlurStyle);
}
void SkBlurMaskFilterImpl::flatten(SkWriteBuffer& buffer) const {
@@ -785,7 +775,7 @@
GrPaint* grp,
const SkStrokeRec& strokeRec,
const SkPath& path) const {
- if (fBlurStyle != SkBlurMaskFilter::kNormal_BlurStyle) {
+ if (fBlurStyle != kNormal_SkBlurStyle) {
return false;
}
@@ -888,7 +878,8 @@
texDesc.fHeight = texSide;
texDesc.fConfig = kAlpha_8_GrPixelConfig;
- GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, blurRRectNinePatchID, ¶ms);
+ GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, blurRRectNinePatchID,
+ ¶ms);
if (NULL == blurNinePatchTexture) {
SkMask mask;
@@ -910,12 +901,15 @@
SkPath path;
path.addRRect( smallRRect );
- SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask, SkMask::kJustRenderImage_CreateMode, SkPaint::kFill_Style);
+ SkDraw::DrawToMask(path, &mask.fBounds, NULL, NULL, &mask,
+ SkMask::kJustRenderImage_CreateMode, SkPaint::kFill_Style);
SkMask blurred_mask;
- SkBlurMask::BoxBlur(&blurred_mask, mask, sigma, SkBlurMask::kNormal_Style, SkBlurMask::kHigh_Quality, NULL, true );
+ SkBlurMask::BoxBlur(&blurred_mask, mask, sigma, kNormal_SkBlurStyle,
+ kHigh_SkBlurQuality, NULL, true );
- blurNinePatchTexture = context->createTexture(¶ms, texDesc, blurRRectNinePatchID, blurred_mask.fImage, 0);
+ blurNinePatchTexture = context->createTexture(¶ms, texDesc, blurRRectNinePatchID,
+ blurred_mask.fImage, 0);
}
if (NULL == blurNinePatchTexture) {
@@ -935,9 +929,10 @@
}
GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTexture *ninePatchTexture)
- : fRRect(rrect),
- fSigma(sigma),
- fNinePatchAccess(ninePatchTexture) {
+ : fRRect(rrect)
+ , fSigma(sigma)
+ , fNinePatchAccess(ninePatchTexture)
+{
this->addTextureAccess(&fNinePatchAccess);
this->setWillReadFragmentPosition();
}
@@ -1070,7 +1065,7 @@
GrPaint* grp,
const SkStrokeRec& strokeRec,
const SkRRect& rrect) const {
- if (fBlurStyle != SkBlurMaskFilter::kNormal_BlurStyle) {
+ if (fBlurStyle != kNormal_SkBlurStyle) {
return false;
}
@@ -1154,7 +1149,7 @@
// If we're doing a normal blur, we can clobber the pathTexture in the
// gaussianBlur. Otherwise, we need to save it for later compositing.
- bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle);
+ bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
*result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOverwriteSrc,
clipRect, false, xformedSigma, xformedSigma);
if (NULL == *result) {
@@ -1169,14 +1164,14 @@
// Blend pathTexture over blurTexture.
GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget());
paint.addColorEffect(GrSimpleTextureEffect::Create(src, matrix))->unref();
- if (SkBlurMaskFilter::kInner_BlurStyle == fBlurStyle) {
+ if (kInner_SkBlurStyle == fBlurStyle) {
// inner: dst = dst * src
paint.setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff);
- } else if (SkBlurMaskFilter::kSolid_BlurStyle == fBlurStyle) {
+ } else if (kSolid_SkBlurStyle == fBlurStyle) {
// solid: dst = src + dst - src * dst
// = (1 - dst) * src + 1 * dst
paint.setBlendFunc(kIDC_GrBlendCoeff, kOne_GrBlendCoeff);
- } else if (SkBlurMaskFilter::kOuter_BlurStyle == fBlurStyle) {
+ } else if (kOuter_SkBlurStyle == fBlurStyle) {
// outer: dst = dst * (1 - src)
// = 0 * src + (1 - src) * dst
paint.setBlendFunc(kZero_GrBlendCoeff, kISC_GrBlendCoeff);
@@ -1198,7 +1193,7 @@
str->appendScalar(fSigma);
str->append(" ");
- static const char* gStyleName[SkBlurMaskFilter::kBlurStyleCount] = {
+ static const char* gStyleName[kLastEnum_SkBlurStyle + 1] = {
"normal", "solid", "outer", "inner"
};
diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp
index 19725f1..9bf5025 100644
--- a/src/effects/SkEmbossMaskFilter.cpp
+++ b/src/effects/SkEmbossMaskFilter.cpp
@@ -76,8 +76,7 @@
const SkMatrix& matrix, SkIPoint* margin) const {
SkScalar sigma = matrix.mapRadius(fBlurSigma);
- if (!SkBlurMask::BoxBlur(dst, src, sigma, SkBlurMask::kInner_Style,
- SkBlurMask::kLow_Quality)) {
+ if (!SkBlurMask::BoxBlur(dst, src, sigma, kInner_SkBlurStyle, kLow_SkBlurQuality)) {
return false;
}
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 1e9f314..028b509 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -103,9 +103,8 @@
paint.setStrokeWidth(SkIntToScalar(strokeWidth));
SkScalar sigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5));
- for (int style = 0; style < SkBlurMaskFilter::kBlurStyleCount; ++style) {
- SkBlurMaskFilter::BlurStyle blurStyle =
- static_cast<SkBlurMaskFilter::BlurStyle>(style);
+ for (int style = 0; style <= kLastEnum_SkBlurStyle; ++style) {
+ SkBlurStyle blurStyle = static_cast<SkBlurStyle>(style);
const uint32_t flagPermutations = SkBlurMaskFilter::kAll_BlurFlag;
for (uint32_t flags = 0; flags < flagPermutations; ++flags) {
@@ -169,7 +168,7 @@
memset(src.fImage, 0xff, src.computeTotalImageSize());
dst.fImage = NULL;
- SkBlurMask::BlurGroundTruth(sigma, &dst, src, SkBlurMask::kNormal_Style);
+ SkBlurMask::BlurGroundTruth(sigma, &dst, src, kNormal_SkBlurStyle);
int midX = dst.fBounds.centerX();
int midY = dst.fBounds.centerY();
@@ -231,7 +230,7 @@
SkPaint blurPaint;
blurPaint.setColor(SK_ColorWHITE);
- SkMaskFilter* filter = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* filter = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
gaussianSigma,
SkBlurMaskFilter::kHighQuality_BlurFlag);
blurPaint.setMaskFilter(filter)->unref();
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index b82aecf..dbe7016 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -150,7 +150,7 @@
SkLayerDrawLooper::Builder looperBuilder;
SkLayerDrawLooper* looper = looperBuilder.detachLooper();
paint.setLooper(looper)->unref();
- SkMaskFilter* mask = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkMaskFilter* mask = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(1)));
paint.setMaskFilter(mask)->unref();