Index: src/effects/SkBlurDrawLooper.cpp |
=================================================================== |
--- src/effects/SkBlurDrawLooper.cpp (revision 10932) |
+++ src/effects/SkBlurDrawLooper.cpp (working copy) |
@@ -6,6 +6,7 @@ |
* found in the LICENSE file. |
*/ |
#include "SkBlurDrawLooper.h" |
+#include "SkBlurMask.h" // just for SkBlurMask::ConvertRadiusToSigma |
#include "SkBlurMaskFilter.h" |
#include "SkCanvas.h" |
#include "SkColorFilter.h" |
@@ -16,11 +17,25 @@ |
#include "SkStringUtils.h" |
SkBlurDrawLooper::SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, |
- SkColor color, uint32_t flags) |
- : fDx(dx), fDy(dy), fBlurColor(color), fBlurFlags(flags), fState(kDone) { |
+ SkColor color, uint32_t flags) { |
+ this->init(SkBlurMask::ConvertRadiusToSigma(radius), dx, dy, color, flags); |
+} |
+SkBlurDrawLooper::SkBlurDrawLooper(SkColor color, SkScalar sigma, |
+ SkScalar dx, SkScalar dy, uint32_t flags) { |
+ this->init(sigma, dx, dy, color, flags); |
+} |
+ |
+void SkBlurDrawLooper::init(SkScalar sigma, SkScalar dx, SkScalar dy, |
+ SkColor color, uint32_t flags) { |
+ fDx = dx; |
+ fDy = dy; |
+ fBlurColor = color; |
+ fBlurFlags = flags; |
+ fState = kDone; |
+ |
SkASSERT(flags <= kAll_BlurFlag); |
- if (radius > 0) { |
+ if (sigma > 0) { |
uint32_t blurFlags = flags & kIgnoreTransform_BlurFlag ? |
SkBlurMaskFilter::kIgnoreTransform_BlurFlag : |
SkBlurMaskFilter::kNone_BlurFlag; |
@@ -29,8 +44,8 @@ |
SkBlurMaskFilter::kHighQuality_BlurFlag : |
SkBlurMaskFilter::kNone_BlurFlag; |
- fBlur = SkBlurMaskFilter::Create(radius, |
- SkBlurMaskFilter::kNormal_BlurStyle, |
+ fBlur = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle, |
+ sigma, |
blurFlags); |
} else { |
fBlur = NULL; |