aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBlurMask.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-05-16 15:20:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-17 14:09:13 +0000
commit51401f07f2e7c650feb13297cc2f5ad50bbc5144 (patch)
tree400fd88d025c3baae51a3082f3defc6e686c34ae /src/core/SkBlurMask.cpp
parentc06754b0466e14e1611fa3144bf337289e6ca82f (diff)
Set margin for outer blur masks with no blur.
The margin of a mask filter is intended to be the additional src region which the mask filter will take into account when creating the dst (a region which will be assumed to be fully transparent around the src). In the event there is an outer blur with no effective blur the src does not need to be considered at all since the outcome will always be an empty mask. The 'margin' is then effectively -inf in all directions, but currently users of margin expect the value to come back non-negative. This sets the margin in this case to 0 to allow the users to do their work and then the filter will simply discard that work. Currently the margin is not being set at all, leading to undefined behavior. In the future the users of mask filters need to be able to handle negative margins and there needs to be a way for the mask filter to signal that it will disregard any src image. BUG=oss-fuzz:8332 Change-Id: Ia9d1711b8c68142134bb6d393de17b9abaf7b23a Reviewed-on: https://skia-review.googlesource.com/128683 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/core/SkBlurMask.cpp')
-rw-r--r--src/core/SkBlurMask.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/SkBlurMask.cpp b/src/core/SkBlurMask.cpp
index 0e0d261903..4b8293c584 100644
--- a/src/core/SkBlurMask.cpp
+++ b/src/core/SkBlurMask.cpp
@@ -119,6 +119,12 @@ bool SkBlurMask::BoxBlur(SkMask* dst, const SkMask& src, SkScalar sigma, SkBlurS
dst->fBounds = SkIRect::MakeEmpty();
dst->fRowBytes = dst->fBounds.width();
dst->fFormat = SkMask::kA8_Format;
+ if (margin != nullptr) {
+ // This filter will disregard the src.fImage completely.
+ // The margin is actually {-(src.fBounds.width() / 2), -(src.fBounds.height() / 2)}
+ // but it is not clear if callers will fall over with negative margins.
+ *margin = SkIPoint{0,0};
+ }
return true;
}
return false;