Increase depth threshold for SkClipStack::isRRect.

Also first check if stack is an intersection of rects.

Bug: skia:
Change-Id: Iaa0c65941b07739998cd8c0a4edd424d995da387
Reviewed-on: https://skia-review.googlesource.com/98761
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-01-23 15:12:07 -05:00 committed by Skia Commit-Bot
parent ea26d6b816
commit 3bfba2a731

View File

@ -963,13 +963,26 @@ void SkClipStack::getConservativeBounds(int offsetX,
}
bool SkClipStack::isRRect(const SkRect& bounds, SkRRect* rrect, bool* aa) const {
// We limit to 5 elements. This means the back element will be bounds checked at most 4 times if
// it is an rrect.
int cnt = fDeque.count();
if (!cnt || cnt > 5) {
const Element* back = static_cast<const Element*>(fDeque.back());
if (!back) {
return false;
}
if (back->fIsIntersectionOfRects) {
const SkRect backRect = back->asDeviceSpaceRRect().rect();
if (!SkRect::Intersects(bounds, backRect)) {
return false;
}
rrect->setRect(backRect);
*aa = back->fDoAA;
return true;
}
// We limit to 17 elements. This means the back element will be bounds checked at most 16 times
// if it is an rrect.
int cnt = fDeque.count();
if (cnt > 17) {
return false;
}
const Element* back = static_cast<const Element*>(fDeque.back());
if (back->getDeviceSpaceType() != SkClipStack::Element::DeviceSpaceType::kRect &&
back->getDeviceSpaceType() != SkClipStack::Element::DeviceSpaceType::kRRect) {
return false;