aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-06 14:16:12 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-06 14:16:12 +0000
commitb7061176c7f414616fe2e79e832b3e0abe326af6 (patch)
tree05269431ac1dfa9b62d5fa34a0351e2f21af712e /gm
parentb27eba7c28c7a52e6af91743ab51c266ed96dccd (diff)
Push sigma-based blur interface into our GMs/benches/tests/samplecode
Diffstat (limited to 'gm')
-rw-r--r--gm/bitmapmatrix.cpp3
-rw-r--r--gm/bleed.cpp7
-rw-r--r--gm/blurquickreject.cpp7
-rw-r--r--gm/blurrect.cpp122
-rw-r--r--gm/blurs.cpp13
-rw-r--r--gm/circles.cpp17
-rw-r--r--gm/drawbitmaprect.cpp10
-rw-r--r--gm/drawlooper.cpp13
-rw-r--r--gm/megalooper.cpp11
-rw-r--r--gm/rects.cpp15
-rw-r--r--gm/shadows.cpp26
-rw-r--r--gm/texteffects.cpp7
12 files changed, 137 insertions, 114 deletions
diff --git a/gm/bitmapmatrix.cpp b/gm/bitmapmatrix.cpp
index ad1329b574..f89cc97b2e 100644
--- a/gm/bitmapmatrix.cpp
+++ b/gm/bitmapmatrix.cpp
@@ -7,6 +7,7 @@
*/
#include "gm.h"
#include "SkBitmap.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkCanvas.h"
#include "SkColor.h"
@@ -83,8 +84,8 @@ protected:
paint.setFilterBitmap(true);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- 5,
SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(5),
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
paint.setMaskFilter(mf)->unref();
diff --git a/gm/bleed.cpp b/gm/bleed.cpp
index 2d3743a5a2..2b2d8497cf 100644
--- a/gm/bleed.cpp
+++ b/gm/bleed.cpp
@@ -6,8 +6,9 @@
*/
#include "gm.h"
-#include "SkCanvas.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
+#include "SkCanvas.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -146,8 +147,8 @@ protected:
SkPaint paint;
paint.setFilterBitmap(filter);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(3),
- SkBlurMaskFilter::kNormal_BlurStyle);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3)));
paint.setMaskFilter(mf)->unref();
canvas->save();
diff --git a/gm/blurquickreject.cpp b/gm/blurquickreject.cpp
index ad8ecdd147..070a59c219 100644
--- a/gm/blurquickreject.cpp
+++ b/gm/blurquickreject.cpp
@@ -6,8 +6,9 @@
*/
#include "gm.h"
-#include "SkCanvas.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
+#include "SkCanvas.h"
// This GM tests out the quick reject bounds of the blur mask filter. It draws
// four blurred rects around a central clip. The blurred rect geometry outset
@@ -55,8 +56,8 @@ protected:
SkPaint blurPaint;
blurPaint.setFilterBitmap(true);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(kBlurRadius,
- SkBlurMaskFilter::kNormal_BlurStyle);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(kBlurRadius));
blurPaint.setMaskFilter(mf)->unref();
canvas->clear(SK_ColorBLACK);
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp
index 49ee33e3af..40bbf71f8c 100644
--- a/gm/blurrect.cpp
+++ b/gm/blurrect.cpp
@@ -6,8 +6,8 @@
*/
#include "gm.h"
-#include "SkBlurMaskFilter.h"
#include "SkBlurMask.h"
+#include "SkBlurMaskFilter.h"
#include "SkCanvas.h"
#include "SkPath.h"
@@ -72,7 +72,8 @@ class BlurRectGM : public skiagm::GM {
public:
BlurRectGM(const char name[], PaintProc pproc, U8CPU alpha,
SkBlurMaskFilter::BlurStyle bs)
- : fMaskFilter(SkBlurMaskFilter::Create(STROKE_WIDTH/2, bs,
+ : fMaskFilter(SkBlurMaskFilter::Create(bs,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(STROKE_WIDTH/2)),
SkBlurMaskFilter::kHighQuality_BlurFlag))
, fName(name)
, fPProc(pproc)
@@ -140,14 +141,15 @@ class BlurRectCompareGM : public skiagm::GM {
SkScalar fRadius;
SkBlurMask::Style fStyle;
public:
- BlurRectCompareGM(const char name[], unsigned int rectWidth, unsigned int rectHeight, float radius, SkBlurMask::Style style)
+ BlurRectCompareGM(const char name[], unsigned int rectWidth,
+ unsigned int rectHeight, float radius,
+ SkBlurMask::Style style)
: fName(name)
, fRectWidth(rectWidth)
, fRectHeight(rectHeight)
, fRadius(radius)
- , fStyle(style)
- {}
-
+ , fStyle(style) {
+ }
int width() const {
return fRectWidth;
}
@@ -216,7 +218,8 @@ public:
protected:
virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
- return SkBlurMask::BlurRect(m, r, this->radius(), this->style());
+ return SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
+ m, r, this->style());
}
private:
typedef BlurRectCompareGM INHERITED;
@@ -224,12 +227,11 @@ private:
class BlurRectSlowGM: public BlurRectCompareGM {
public:
- BlurRectSlowGM(const char name[], unsigned int rect_width, unsigned int rect_height,
- float blur_radius, SkBlurMask::Style style) :
- INHERITED(name, rect_width, rect_height, blur_radius, style)
- {
-
+ BlurRectSlowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
+ float blurRadius, SkBlurMask::Style style)
+ : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
+
protected:
virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
SkMask src;
@@ -242,7 +244,9 @@ protected:
memset(src.fImage, 0xff, src.computeTotalImageSize());
- return SkBlurMask::Blur(m, src, this->radius(), this->style(), this->getQuality());
+ return SkBlurMask::BoxBlur(m, src,
+ SkBlurMask::ConvertRadiusToSigma(this->radius()),
+ this->style(), this->getQuality());
}
virtual SkBlurMask::Quality getQuality() {
@@ -255,11 +259,10 @@ private:
class BlurRectSlowLowGM: public BlurRectSlowGM {
public:
BlurRectSlowLowGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
- float blurRadius, SkBlurMask::Style style) :
- INHERITED(name, rectWidth, rectHeight, blurRadius, style)
- {
-
+ float blurRadius, SkBlurMask::Style style)
+ : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
+
protected:
virtual SkBlurMask::Quality getQuality() SK_OVERRIDE {
return SkBlurMask::kLow_Quality;
@@ -271,11 +274,10 @@ private:
class BlurRectGroundTruthGM: public BlurRectCompareGM {
public:
BlurRectGroundTruthGM(const char name[], unsigned int rectWidth, unsigned int rectHeight,
- float blurRadius, SkBlurMask::Style style) :
- INHERITED(name, rectWidth, rectHeight, blurRadius, style)
- {
-
+ float blurRadius, SkBlurMask::Style style)
+ : INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
+
protected:
virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
SkMask src;
@@ -288,7 +290,8 @@ protected:
memset(src.fImage, 0xff, src.computeTotalImageSize());
- return SkBlurMask::BlurGroundTruth(m, src, this->radius(), this->style());
+ return SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radius()),
+ m, src, this->style());
}
virtual SkBlurMask::Quality getQuality() {
@@ -306,50 +309,53 @@ DEF_GM(return new BlurRectGM("blurrect", NULL, 0xFF, SkBlurMaskFilter::kSolid_Bl
DEF_GM(return new BlurRectGM("blurrect", NULL, 0xFF, SkBlurMaskFilter::kOuter_BlurStyle);)
DEF_GM(return new BlurRectGM("blurrect", NULL, 0xFF, SkBlurMaskFilter::kInner_BlurStyle);)
+static const SkScalar kBig = SkFloatToScalar(20);
+static const SkScalar kSmall = SkFloatToScalar(2);
+
// 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, 2, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_normal_fast", 25, 100, 20, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_normal_slow", 25, 100, 2, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_normal_slow", 25, 100, 20, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_inner_fast", 25, 100, 2, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_inner_fast", 25, 100, 20, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_inner_slow", 25, 100, 2, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_inner_slow", 25, 100, 20, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_25_100_2_outer_fast", 25, 100, 2, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_25_100_20_outer_fast", 25, 100, 20, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_25_100_2_outer_slow", 25, 100, 2, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_25_100_20_outer_slow", 25, 100, 20, SkBlurMask::kOuter_Style);)
+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);)
// skinny tall rects, blurs overlap in X but not y
-DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_normal_fast", 5, 100, 2 , SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_normal_fast", 5, 100, 20, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_normal_slow", 5, 100, 2 , SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_normal_slow", 5, 100, 20, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_inner_fast", 5, 100, 2 , SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_inner_fast", 5, 100, 20, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_inner_slow", 5, 100, 2 , SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_inner_slow", 5, 100, 20, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_100_2_outer_fast", 5, 100, 2 , SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_100_20_outer_fast", 5, 100, 20, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_100_2_outer_slow", 5, 100, 2 , SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_100_20_outer_slow", 5, 100, 20, SkBlurMask::kOuter_Style);)
+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);)
// tiny rects, blurs overlap in X and Y
-DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_normal_fast", 5, 5, 2 , SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_normal_fast", 5, 5, 20, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_normal_slow", 5, 5, 2 , SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_normal_slow", 5, 5, 20, SkBlurMask::kNormal_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_inner_fast", 5, 5, 2 , SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_inner_fast", 5, 5, 20, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_inner_slow", 5, 5, 2 , SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_inner_slow", 5, 5, 20, SkBlurMask::kInner_Style);)
-DEF_GM(return new BlurRectFastGM( "blurrect_5_5_2_outer_fast", 5, 5, 2 , SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectFastGM("blurrect_5_5_20_outer_fast", 5, 5, 20, SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM( "blurrect_5_5_2_outer_slow", 5, 5, 2 , SkBlurMask::kOuter_Style);)
-DEF_GM(return new BlurRectSlowGM("blurrect_5_5_20_outer_slow", 5, 5, 20, SkBlurMask::kOuter_Style);)
+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);)
#if 0
diff --git a/gm/blurs.cpp b/gm/blurs.cpp
index 988fbe2943..f3808d27c9 100644
--- a/gm/blurs.cpp
+++ b/gm/blurs.cpp
@@ -6,6 +6,7 @@
* found in the LICENSE file.
*/
#include "gm.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
namespace skiagm {
@@ -59,8 +60,9 @@ protected:
paint.setColor(SK_ColorBLUE);
for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
if (gRecs[i].fStyle != NONE) {
- SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkIntToScalar(20), gRecs[i].fStyle, flags);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(gRecs[i].fStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(20)),
+ flags);
paint.setMaskFilter(mf)->unref();
} else {
paint.setMaskFilter(NULL);
@@ -72,10 +74,9 @@ protected:
}
// draw text
{
- SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkIntToScalar(4),
- SkBlurMaskFilter::kNormal_BlurStyle,
- flags);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4)),
+ flags);
paint.setMaskFilter(mf)->unref();
SkScalar x = SkIntToScalar(70);
SkScalar y = SkIntToScalar(400);
diff --git a/gm/circles.cpp b/gm/circles.cpp
index 1fe114a287..a1aff75460 100644
--- a/gm/circles.cpp
+++ b/gm/circles.cpp
@@ -6,12 +6,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
-#include "SkTArray.h"
-#include "SkRandom.h"
-#include "SkMatrix.h"
+#include "SkBlurDrawLooper.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkGradientShader.h"
-#include "SkBlurDrawLooper.h"
+#include "SkMatrix.h"
+#include "SkRandom.h"
+#include "SkTArray.h"
namespace skiagm {
@@ -50,8 +51,9 @@ protected:
// AA with mask filter
SkPaint p;
p.setAntiAlias(true);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(5),
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(
SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag);
p.setMaskFilter(mf)->unref();
fPaints.push_back(p);
@@ -79,8 +81,9 @@ protected:
SkPaint p;
p.setAntiAlias(true);
SkBlurDrawLooper* shadowLooper =
- new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5),
- SkIntToScalar(10), 0xFF0000FF,
+ new SkBlurDrawLooper (SK_ColorBLUE,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(10)),
+ SkIntToScalar(5), SkIntToScalar(10),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
SkBlurDrawLooper::kHighQuality_BlurFlag);
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 16cd6e48cb..106f6d393e 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -6,13 +6,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
-#include "SkShader.h"
-#include "SkColorPriv.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
-
-// effects
+#include "SkColorPriv.h"
#include "SkGradientShader.h"
-
+#include "SkShader.h"
namespace skiagm {
@@ -169,8 +167,8 @@ protected:
srcRect.setXYWH(1, 1, 3, 3);
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- 5,
SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag);
paint.setMaskFilter(mf)->unref();
diff --git a/gm/drawlooper.cpp b/gm/drawlooper.cpp
index 58c691c311..4cc6e8e369 100644
--- a/gm/drawlooper.cpp
+++ b/gm/drawlooper.cpp
@@ -6,11 +6,12 @@
*/
#include "gm.h"
+#include "SkBlurMask.h"
+#include "SkBlurMaskFilter.h"
#include "SkCanvas.h"
#include "SkGraphics.h"
-#include "SkRandom.h"
#include "SkLayerDrawLooper.h"
-#include "SkBlurMaskFilter.h"
+#include "SkRandom.h"
#define WIDTH 200
#define HEIGHT 200
@@ -62,12 +63,12 @@ private:
SkPaint::Style fStyle;
SkScalar fWidth;
SkScalar fOffset;
- int fBlur;
+ SkScalar fBlur;
} gParams[] = {
{ SK_ColorWHITE, SkPaint::kStroke_Style, SkIntToScalar(1)*3/4, 0, 0 },
{ SK_ColorRED, SkPaint::kStroke_Style, SkIntToScalar(4), 0, 0 },
{ SK_ColorBLUE, SkPaint::kFill_Style, 0, 0, 0 },
- { 0x88000000, SkPaint::kFill_Style, 0, SkIntToScalar(10), 3 }
+ { 0x88000000, SkPaint::kFill_Style, 0, SkIntToScalar(10), SkIntToScalar(3) }
};
fLooper = new SkLayerDrawLooper;
@@ -85,8 +86,8 @@ private:
paint->setStyle(gParams[i].fStyle);
paint->setStrokeWidth(gParams[i].fWidth);
if (gParams[i].fBlur > 0) {
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(gParams[i].fBlur),
- SkBlurMaskFilter::kNormal_BlurStyle);
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(gParams[i].fBlur));
paint->setMaskFilter(mf)->unref();
}
}
diff --git a/gm/megalooper.cpp b/gm/megalooper.cpp
index 0f3811a8bf..9a1de70dfa 100644
--- a/gm/megalooper.cpp
+++ b/gm/megalooper.cpp
@@ -6,10 +6,11 @@
*/
#include "gm.h"
-#include "SkCanvas.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
-#include "SkLayerDrawLooper.h"
+#include "SkCanvas.h"
#include "SkColorFilter.h"
+#include "SkLayerDrawLooper.h"
// This GM tests 3 different ways of drawing four shadows around a square:
// just using 4 blurred rects
@@ -110,10 +111,10 @@ private:
}
SkMaskFilter* createBlur() {
- static const SkScalar kBlurRadius = 25.0f;
+ static const SkScalar kBlurSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(25));
- return SkBlurMaskFilter::Create(kBlurRadius,
- SkBlurMaskFilter::kNormal_BlurStyle,
+ return SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ kBlurSigma,
SkBlurMaskFilter::kHighQuality_BlurFlag);
}
diff --git a/gm/rects.cpp b/gm/rects.cpp
index f2fa989a4d..6350ea9dd1 100644
--- a/gm/rects.cpp
+++ b/gm/rects.cpp
@@ -6,11 +6,12 @@
*/
#include "gm.h"
-#include "SkTArray.h"
-#include "SkMatrix.h"
+#include "SkBlurDrawLooper.h"
+#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkGradientShader.h"
-#include "SkBlurDrawLooper.h"
+#include "SkMatrix.h"
+#include "SkTArray.h"
namespace skiagm {
@@ -53,8 +54,9 @@ protected:
SkPaint p;
p.setColor(SK_ColorWHITE);
p.setAntiAlias(true);
- SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(5),
+ SkMaskFilter* mf = SkBlurMaskFilter::Create(
SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
SkBlurMaskFilter::kHighQuality_BlurFlag);
p.setMaskFilter(mf)->unref();
fPaints.push_back(p);
@@ -84,8 +86,9 @@ protected:
p.setColor(SK_ColorWHITE);
p.setAntiAlias(true);
SkBlurDrawLooper* shadowLooper =
- new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5),
- SkIntToScalar(10), SK_ColorWHITE,
+ new SkBlurDrawLooper (SK_ColorWHITE,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(10)),
+ SkIntToScalar(5), SkIntToScalar(10),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
SkBlurDrawLooper::kHighQuality_BlurFlag);
diff --git a/gm/shadows.cpp b/gm/shadows.cpp
index d7a12548cd..d0d23a8047 100644
--- a/gm/shadows.cpp
+++ b/gm/shadows.cpp
@@ -6,6 +6,7 @@
* found in the LICENSE file.
*/
#include "gm.h"
+#include "SkBlurMask.h"
#include "SkBlurDrawLooper.h"
namespace skiagm {
@@ -46,34 +47,39 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
SkBlurDrawLooper* shadowLoopers[5];
shadowLoopers[0] =
- new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5),
- SkIntToScalar(10), 0xFF0000FF,
+ new SkBlurDrawLooper (SK_ColorBLUE,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(10)),
+ SkIntToScalar(5), SkIntToScalar(10),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL0(shadowLoopers[0]);
shadowLoopers[1] =
- new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5),
- SkIntToScalar(10), 0xFF0000FF,
+ new SkBlurDrawLooper (SK_ColorBLUE,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(10)),
+ SkIntToScalar(5), SkIntToScalar(10),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag);
SkAutoUnref aurL1(shadowLoopers[1]);
shadowLoopers[2] =
- new SkBlurDrawLooper (SkIntToScalar(5), SkIntToScalar(5),
- SkIntToScalar(10), 0xFF000000,
+ new SkBlurDrawLooper (SK_ColorBLACK,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
+ SkIntToScalar(5),
+ SkIntToScalar(10),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL2(shadowLoopers[2]);
shadowLoopers[3] =
- new SkBlurDrawLooper (SkIntToScalar(5), SkIntToScalar(-5),
- SkIntToScalar(-10), 0x7FFF0000,
+ new SkBlurDrawLooper (0x7FFF0000,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)),
+ SkIntToScalar(-5), SkIntToScalar(-10),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL3(shadowLoopers[3]);
shadowLoopers[4] =
- new SkBlurDrawLooper (SkIntToScalar(0), SkIntToScalar(5),
- SkIntToScalar(5), 0xFF000000,
+ new SkBlurDrawLooper (SK_ColorBLACK, SkIntToScalar(0),
+ SkIntToScalar(5), SkIntToScalar(5),
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
SkBlurDrawLooper::kHighQuality_BlurFlag);
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp
index 782850e2f6..b46753d6d2 100644
--- a/gm/texteffects.cpp
+++ b/gm/texteffects.cpp
@@ -6,13 +6,14 @@
*/
#include "gm.h"
+#include "SkBlurMask.h"
+#include "SkBlurMaskFilter.h"
#include "SkFlattenableBuffers.h"
#include "SkLayerRasterizer.h"
-#include "SkBlurMaskFilter.h"
static void r0(SkLayerRasterizer* rast, SkPaint& p) {
- p.setMaskFilter(SkBlurMaskFilter::Create(SkIntToScalar(3),
- SkBlurMaskFilter::kNormal_BlurStyle))->unref();
+ p.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref();
rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3));
p.setMaskFilter(NULL);