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>
This commit is contained in:
Mike Reed 2020-03-10 17:10:04 -04:00 committed by Skia Commit-Bot
parent 3439323afd
commit bf355123ae

View File

@ -1651,9 +1651,19 @@ void SkCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeSty
void SkCanvas::clipShader(sk_sp<SkShader> sh, SkClipOp op) {
if (sh) {
if (sh->isOpaque()) {
if (op == SkClipOp::kIntersect) {
// we don't occlude anything, so skip this call
} else {
SkASSERT(op == SkClipOp::kDifference);
// we occlude everything, so set the clip to empty
this->clipRect({0,0,0,0});
}
} else {
this->onClipShader(std::move(sh), op);
}
}
}
void SkCanvas::onClipShader(sk_sp<SkShader> sh, SkClipOp op) {
AutoValidateClip avc(this);