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>
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 29f4830..f224448 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -57,7 +57,9 @@
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;