Snug the clip with path bounds inside SkAAClip
https://codereview.chromium.org/2482193004/ is related with this patch.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4636
Change-Id: Ibd6d64578e08c75a3cfcef45489afc9b59ad40be
Reviewed-on: https://skia-review.googlesource.com/4636
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 1a60754..467939b 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -1403,12 +1403,18 @@
clip = &tmpClip;
}
+ // Since we assert that the BuilderBlitter will never blit outside the intersection
+ // of clip and ibounds, we create this snugClip to be that intersection and send it
+ // to the scan-converter.
+ SkRegion snugClip(*clip);
+
if (path.isInverseFillType()) {
ibounds = clip->getBounds();
} else {
if (ibounds.isEmpty() || !ibounds.intersect(clip->getBounds())) {
return this->setEmpty();
}
+ snugClip.op(ibounds, SkRegion::kIntersect_Op);
}
Builder builder(ibounds);
@@ -1416,12 +1422,12 @@
if (doAA) {
if (gSkUseAnalyticAA.load()) {
- SkScan::AAAFillPath(path, *clip, &blitter, true);
+ SkScan::AAAFillPath(path, snugClip, &blitter, true);
} else {
- SkScan::AntiFillPath(path, *clip, &blitter, true);
+ SkScan::AntiFillPath(path, snugClip, &blitter, true);
}
} else {
- SkScan::FillPath(path, *clip, &blitter);
+ SkScan::FillPath(path, snugClip, &blitter);
}
blitter.finish();