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

Unified Diff: src/effects/SkBlurDrawLooper.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Removed unneeded #includes Created 7 years, 4 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 | « src/core/SkPicture.cpp ('k') | src/effects/SkBlurMask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/effects/SkBlurMask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698