diff options
-rw-r--r-- | include/core/SkRRect.h | 8 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 26 |
2 files changed, 22 insertions, 12 deletions
diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h index 66c433f43b..e70cff6db9 100644 --- a/include/core/SkRRect.h +++ b/include/core/SkRRect.h @@ -26,15 +26,9 @@ class SkMatrix; // use growToInclude to fit skp round rects & generate stats (RRs vs. real paths) // check on # of rectorus's the RRs could handle // rendering work -// add entry points (clipRRect, drawRRect) - plumb down to SkBaseDevice -// update SkPath.addRRect() to take an SkRRect - only use quads -// -- alternatively add addRRectToPath here +// update SkPath.addRRect() to only use quads // add GM and bench -// clipping opt -// update SkClipStack to perform logic with RRs // further out -// add RR rendering shader to Ganesh (akin to cicle drawing code) -// - only for simple RRs // detect and triangulate RRectorii rather than falling back to SW in Ganesh // diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 7025e53eb1..cffc46aed8 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1236,12 +1236,28 @@ bool SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { if (rrect.isRect()) { // call the non-virtual version return this->SkCanvas::clipRect(rrect.getBounds(), op, doAA); - } else { - SkPath path; - path.addRRect(rrect); - // call the non-virtual version - return this->SkCanvas::clipPath(path, op, doAA); } + + SkRRect transformedRRect; + if (rrect.transform(*fMCRec->fMatrix, &transformedRRect)) { + AutoValidateClip avc(this); + + fDeviceCMDirty = true; + fCachedLocalClipBoundsDirty = true; + doAA &= fAllowSoftClip; + + fClipStack.clipDevRRect(transformedRRect, op, doAA); + + SkPath devPath; + devPath.addRRect(transformedRRect); + + return clipPathHelper(this, fMCRec->fRasterClip, devPath, op, doAA); + } + + SkPath path; + path.addRRect(rrect); + // call the non-virtual version + return this->SkCanvas::clipPath(path, op, doAA); } bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { |