From f276fa74f56d0c691716163d3149fce5de97c9ea Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 21 Nov 2012 14:14:10 +0000 Subject: [PATCH] limit the rects width/height as well as its coords, when avoiding too-large rects for blur special-case. Review URL: https://codereview.appspot.com/6850084 git-svn-id: http://skia.googlecode.com/svn/trunk@6523 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/effects/SkBlurMaskFilter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 2e031d8056..63ed821705 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -145,8 +145,9 @@ static bool drawRectsIntoMask(const SkRect rects[], int count, SkMask* mask) { return true; } -static bool rect_coordinates_exceed(const SkRect& r, SkScalar v) { - return r.fLeft < -v || r.fTop < -v || r.fRight > v || r.fBottom > v; +static bool rect_exceeds(const SkRect& r, SkScalar v) { + return r.fLeft < -v || r.fTop < -v || r.fRight > v || r.fBottom > v || + r.width() > v || r.height() > v; } SkMaskFilter::FilterReturn @@ -160,7 +161,7 @@ SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count, // TODO: take clipBounds into account to limit our coordinates up front // for now, just skip too-large src rects (to take the old code path). - if (rect_coordinates_exceed(rects[0], SkIntToScalar(32767))) { + if (rect_exceeds(rects[0], SkIntToScalar(32767))) { return kUnimplemented_FilterReturn; }