Skip to content

Commit bf35512

Browse files
reed-at-googleSkia Commit-Bot
authored andcommitted
we can handle opaque clip-shaders up front
Change-Id: I6ac1470dfe5005479b52a0ae662874fd0f7b61c3 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276316 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Reed <reed@google.com>
1 parent 3439323 commit bf35512

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/core/SkCanvas.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,17 @@ void SkCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeSty
16511651

16521652
void SkCanvas::clipShader(sk_sp<SkShader> sh, SkClipOp op) {
16531653
if (sh) {
1654-
this->onClipShader(std::move(sh), op);
1654+
if (sh->isOpaque()) {
1655+
if (op == SkClipOp::kIntersect) {
1656+
// we don't occlude anything, so skip this call
1657+
} else {
1658+
SkASSERT(op == SkClipOp::kDifference);
1659+
// we occlude everything, so set the clip to empty
1660+
this->clipRect({0,0,0,0});
1661+
}
1662+
} else {
1663+
this->onClipShader(std::move(sh), op);
1664+
}
16551665
}
16561666
}
16571667

0 commit comments

Comments
 (0)