Add sniff for rect, oval & rrect to SkCanvas::clipPath
Review URL: https://codereview.chromium.org/1466303004
This commit is contained in:
parent
baf8fcbb1b
commit
39f0538178
@ -1600,12 +1600,26 @@ void SkCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle
|
|||||||
void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
|
void SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
|
||||||
this->checkForDeferredSave();
|
this->checkForDeferredSave();
|
||||||
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
|
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
|
||||||
SkRect r;
|
|
||||||
if (!path.isInverseFillType() && path.isRect(&r)) {
|
if (!path.isInverseFillType() && fMCRec->fMatrix.rectStaysRect()) {
|
||||||
this->onClipRect(r, op, edgeStyle);
|
SkRect r;
|
||||||
} else {
|
if (path.isRect(&r)) {
|
||||||
this->onClipPath(path, op, edgeStyle);
|
this->onClipRect(r, op, edgeStyle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SkRRect rrect;
|
||||||
|
if (path.isOval(&r)) {
|
||||||
|
rrect.setOval(r);
|
||||||
|
this->onClipRRect(rrect, op, edgeStyle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (path.isRRect(&rrect)) {
|
||||||
|
this->onClipRRect(rrect, op, edgeStyle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->onClipPath(path, op, edgeStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
|
void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
|
||||||
|
Loading…
Reference in New Issue
Block a user