explicitly call "our" version of clipPath in the case when clipRect needs to

turn itself into a path when the matrix rotates. This avoids infinite recursion
when the canvas is subclassed (e.g. SkPicture's recording canvas).



git-svn-id: http://skia.googlecode.com/svn/trunk@100 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-03-02 19:41:36 +00:00
parent 3abec1d7c3
commit 98de2bdbd1

View File

@ -813,6 +813,10 @@ bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
fLocalBoundsCompareTypeDirty = true;
if (fMCRec->fMatrix->rectStaysRect()) {
// for these simpler matrices, we can stay a rect ever after applying
// the matrix. This means we don't have to a) make a path, and b) tell
// the region code to scan-convert the path, only to discover that it
// is really just a rect.
SkRect r;
SkIRect ir;
@ -820,10 +824,14 @@ bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
r.round(&ir);
return fMCRec->fRegion->op(ir, op);
} else {
// since we're rotate or some such thing, we convert the rect to a path
// and clip against that, since it can handle any matrix. However, to
// avoid recursion in the case where we are subclassed (e.g. Pictures)
// we explicitly call "our" version of clipPath.
SkPath path;
path.addRect(rect);
return this->clipPath(path, op);
return this->SkCanvas::clipPath(path, op);
}
}