aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBlurMask.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-05-14 11:14:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-14 16:59:29 +0000
commit8f2b7fa61765efcaf0a071aabe1db6c59122ab24 (patch)
treeda0a52d64594e871fa71465d5538bdd02c91d0b8 /src/core/SkBlurMask.cpp
parent0e6db75eebab430e7f6665c8cfa1e7dcd2fef123 (diff)
Correctly handle empty outer blurs.
Most blur styles approach the original mask as the sigma goes to zero. The outer style however approaches nothing as the mask sigma goes to zero. Handle this case correctly. Change-Id: I14f76e144d7cfc78aeaff30ff5444a21f1e5f98b Reviewed-on: https://skia-review.googlesource.com/128006 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
Diffstat (limited to 'src/core/SkBlurMask.cpp')
-rw-r--r--src/core/SkBlurMask.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/SkBlurMask.cpp b/src/core/SkBlurMask.cpp
index f4fa100961..0e0d261903 100644
--- a/src/core/SkBlurMask.cpp
+++ b/src/core/SkBlurMask.cpp
@@ -110,9 +110,17 @@ bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, SkScalar sigma, SkBlurS
return false;
}
-
SkMaskBlurFilter blurFilter{sigma, sigma};
- if (blurFilter.hasNoBlur() && style != kOuter_SkBlurStyle) {
+ if (blurFilter.hasNoBlur()) {
+ // If there is no effective blur most styles will just produce the original mask.
+ // However, kOuter_SkBlurStyle will produce an empty mask.
+ if (style == kOuter_SkBlurStyle) {
+ dst->fImage = nullptr;
+ dst->fBounds = SkIRect::MakeEmpty();
+ dst->fRowBytes = dst->fBounds.width();
+ dst->fFormat = SkMask::kA8_Format;
+ return true;
+ }
return false;
}
const SkIPoint border = blurFilter.blur(src, dst);