limit the rects width/height as well as its coords, when avoiding too-large
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 21 Nov 2012 14:14:10 +0000 (14:14 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 21 Nov 2012 14:14:10 +0000 (14:14 +0000)
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

index 2e031d8..63ed821 100644 (file)
@@ -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;
     }