Index: src/effects/SkBlurMask.cpp |
diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp |
index c04a6f89f8d46783f2f232ec58c94977552edc24..bf50845ab6cb1d308562ea44fa279133bcafd46f 100644 |
--- a/src/effects/SkBlurMask.cpp |
+++ b/src/effects/SkBlurMask.cpp |
@@ -13,17 +13,21 @@ |
#include "SkEndian.h" |
+// This constant approximates the scaling done in the software path's |
+// "high quality" mode, in SkBlurMask::Blur() (1 / sqrt(3)). |
+// IMHO, it actually should be 1: we blur "less" than we should do |
+// according to the CSS and canvas specs, simply because Safari does the same. |
+// Firefox used to do the same too, until 4.0 where they fixed it. So at some |
+// point we should probably get rid of these scaling constants and rebaseline |
+// all the blur tests. |
+static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f; |
+ |
SkScalar SkBlurMask::ConvertRadiusToSigma(SkScalar radius) { |
- // This constant approximates the scaling done in the software path's |
- // "high quality" mode, in SkBlurMask::Blur() (1 / sqrt(3)). |
- // IMHO, it actually should be 1: we blur "less" than we should do |
- // according to the CSS and canvas specs, simply because Safari does the same. |
- // Firefox used to do the same too, until 4.0 where they fixed it. So at some |
- // point we should probably get rid of these scaling constants and rebaseline |
- // all the blur tests. |
- static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f; |
- |
- return radius ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f; |
+ return radius > 0 ? kBLUR_SIGMA_SCALE * radius + 0.5f : 0.0f; |
+} |
+ |
+SkScalar SkBlurMask::ConvertSigmaToRadius(SkScalar sigma) { |
+ return sigma > 0.5f ? (sigma - 0.5f) / kBLUR_SIGMA_SCALE : 0.0f; |
} |
#define UNROLL_SEPARABLE_LOOPS |