Blur refactoring
https://codereview.chromium.org/21835004/
git-svn-id: http://skia.googlecode.com/svn/trunk@10936 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp
index 5a18d16..2cb962f 100644
--- a/gm/blurrect.cpp
+++ b/gm/blurrect.cpp
@@ -71,12 +71,12 @@
SkAlpha fAlpha;
public:
BlurRectGM(const char name[], PaintProc pproc, U8CPU alpha,
- SkBlurMaskFilter::BlurStyle bs) :
- fMaskFilter(SkBlurMaskFilter::Create(STROKE_WIDTH/2, bs,
- SkBlurMaskFilter::kHighQuality_BlurFlag))
- , fName(name)
- , fPProc(pproc)
- , fAlpha(SkToU8(alpha)) {
+ SkBlurMaskFilter::BlurStyle bs)
+ : fMaskFilter(SkBlurMaskFilter::Create(STROKE_WIDTH/2, bs,
+ SkBlurMaskFilter::kHighQuality_BlurFlag))
+ , fName(name)
+ , fPProc(pproc)
+ , fAlpha(SkToU8(alpha)) {
fName.appendf("_%s", gBlurStyle2Name[bs]);
}
@@ -208,13 +208,12 @@
class BlurRectFastGM: public BlurRectCompareGM {
public:
- BlurRectFastGM(const char name[], unsigned int rect_width,
- unsigned int rect_height, float blur_radius,
+ BlurRectFastGM(const char name[], unsigned int rectWidth,
+ unsigned int rectHeight, float blurRadius,
SkBlurMask::Style style) :
- INHERITED(name, rect_width, rect_height, blur_radius, style)
- {
-
+ INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
}
+
protected:
virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
return SkBlurMask::BlurRect(m, r, this->radius(), this->style());
diff --git a/gm/blurs.cpp b/gm/blurs.cpp
index 22804c7..988fbe2 100644
--- a/gm/blurs.cpp
+++ b/gm/blurs.cpp
@@ -60,31 +60,29 @@
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
- );
+ SkIntToScalar(20), gRecs[i].fStyle, flags);
paint.setMaskFilter(mf)->unref();
} else {
paint.setMaskFilter(NULL);
}
- canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100)
- , SkIntToScalar(200 + gRecs[i].fCy*100)
- , SkIntToScalar(50)
- , paint);
+ canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100),
+ SkIntToScalar(200 + gRecs[i].fCy*100),
+ SkIntToScalar(50),
+ paint);
}
// draw text
{
SkMaskFilter* mf = SkBlurMaskFilter::Create(
- SkIntToScalar(4)
- , SkBlurMaskFilter::kNormal_BlurStyle
- , flags
- );
+ SkIntToScalar(4),
+ SkBlurMaskFilter::kNormal_BlurStyle,
+ flags);
paint.setMaskFilter(mf)->unref();
SkScalar x = SkIntToScalar(70);
SkScalar y = SkIntToScalar(400);
paint.setColor(SK_ColorBLACK);
canvas->drawText("Hamburgefons Style", 18, x, y, paint);
- canvas->drawText("Hamburgefons Style", 18
- , x, y + SkIntToScalar(50), paint);
+ canvas->drawText("Hamburgefons Style", 18,
+ x, y + SkIntToScalar(50), paint);
paint.setMaskFilter(NULL);
paint.setColor(SK_ColorWHITE);
x -= SkIntToScalar(2);
diff --git a/gm/circles.cpp b/gm/circles.cpp
index 4513934..1fe114a 100644
--- a/gm/circles.cpp
+++ b/gm/circles.cpp
@@ -83,7 +83,7 @@
SkIntToScalar(10), 0xFF0000FF,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
- SkBlurDrawLooper::kHighQuality_BlurFlag );
+ SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL0(shadowLooper);
p.setLooper(shadowLooper);
fPaints.push_back(p);
diff --git a/gm/rects.cpp b/gm/rects.cpp
index eee92b3..f2fa989 100644
--- a/gm/rects.cpp
+++ b/gm/rects.cpp
@@ -88,7 +88,7 @@
SkIntToScalar(10), SK_ColorWHITE,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
- SkBlurDrawLooper::kHighQuality_BlurFlag );
+ SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL0(shadowLooper);
p.setLooper(shadowLooper);
fPaints.push_back(p);
diff --git a/gm/shadows.cpp b/gm/shadows.cpp
index 2fb1615..d7a1254 100644
--- a/gm/shadows.cpp
+++ b/gm/shadows.cpp
@@ -50,33 +50,33 @@
SkIntToScalar(10), 0xFF0000FF,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
- SkBlurDrawLooper::kHighQuality_BlurFlag );
+ SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL0(shadowLoopers[0]);
shadowLoopers[1] =
new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5),
SkIntToScalar(10), 0xFF0000FF,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
- SkBlurDrawLooper::kOverrideColor_BlurFlag );
+ SkBlurDrawLooper::kOverrideColor_BlurFlag);
SkAutoUnref aurL1(shadowLoopers[1]);
shadowLoopers[2] =
new SkBlurDrawLooper (SkIntToScalar(5), SkIntToScalar(5),
SkIntToScalar(10), 0xFF000000,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
- SkBlurDrawLooper::kHighQuality_BlurFlag );
+ SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL2(shadowLoopers[2]);
shadowLoopers[3] =
new SkBlurDrawLooper (SkIntToScalar(5), SkIntToScalar(-5),
SkIntToScalar(-10), 0x7FFF0000,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
- SkBlurDrawLooper::kHighQuality_BlurFlag );
+ SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL3(shadowLoopers[3]);
shadowLoopers[4] =
new SkBlurDrawLooper (SkIntToScalar(0), SkIntToScalar(5),
SkIntToScalar(5), 0xFF000000,
SkBlurDrawLooper::kIgnoreTransform_BlurFlag |
SkBlurDrawLooper::kOverrideColor_BlurFlag |
- SkBlurDrawLooper::kHighQuality_BlurFlag );
+ SkBlurDrawLooper::kHighQuality_BlurFlag);
SkAutoUnref aurL4(shadowLoopers[4]);
static const struct {