simplify asClipRgn to not rely on pathops

bug: skia:9734
Change-Id: I7beb45ac26192f0fbc4643e64309536673ae0630
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261281
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2019-12-20 12:49:37 -05:00 committed by Skia Commit-Bot
parent b47eb188cc
commit 2fad846c0b

View File

@ -79,9 +79,18 @@ void SkClipStackDevice::onAsRgnClip(SkRegion* rgn) const {
if (isIntersectionOfRects && SkClipStack::kNormal_BoundsType == boundType) {
rgn->setRect(bounds.round());
} else {
SkPath path;
fClipStack.asPath(&path);
rgn->setPath(path, SkRegion(SkIRect::MakeWH(this->width(), this->height())));
SkRegion boundsRgn({0, 0, this->width(), this->height()});
SkPath tmpPath;
*rgn = boundsRgn;
SkClipStack::B2TIter iter(fClipStack);
while (auto elem = iter.next()) {
tmpPath.rewind();
elem->asDeviceSpacePath(&tmpPath);
SkRegion tmpRgn;
tmpRgn.setPath(tmpPath, boundsRgn);
rgn->op(tmpRgn, SkRegion::Op(elem->getOp()));
}
}
}