diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-10-31 11:30:46 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-31 16:16:44 +0000 |
commit | b1fc36829de69da5376019403fdd649c06f4cf1b (patch) | |
tree | 3d0d58d973aad9b670dc0ef4a136719d41447bf1 /src/gpu/GrReducedClip.cpp | |
parent | 9d15b07dc4a97683a0774c74f3135a51cd29e9b0 (diff) |
Fix int overflow issues with clip and path bounds.
* Clamp scissor clip bounds to query bounds (which are RT bounds)
* Change IsInsideClip test to be more int overflow friendly
* Check to make sure path bounds can have representable width and height
Bug: skia:7239
Bug: skia:7240
Change-Id: I4c512d05c5609a5a466393408282101697ebea83
Reviewed-on: https://skia-review.googlesource.com/65506
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/GrReducedClip.cpp')
-rw-r--r-- | src/gpu/GrReducedClip.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 29f483022b..f22444895b 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -57,7 +57,9 @@ GrReducedClip::GrReducedClip(const SkClipStack& stack, const SkRect& queryBounds SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); if (!iter.prev()->isAA() || GrClip::IsPixelAligned(stackBounds)) { // The clip is a non-aa rect. Here we just implement the entire thing using fScissor. - stackBounds.round(&fScissor); + SkRect tightBounds; + SkAssertResult(tightBounds.intersect(stackBounds, queryBounds)); + tightBounds.round(&fScissor); fHasScissor = true; fInitialState = fScissor.isEmpty() ? InitialState::kAllOut : InitialState::kAllIn; return; |