Make canvas pass rrects along to clip stack
BUG=skia:2181
R=robertphillips@google.com, reed@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/167283004
git-svn-id: http://skia.googlecode.com/svn/trunk@13470 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h
index 66c433f..e70cff6 100644
--- a/include/core/SkRRect.h
+++ b/include/core/SkRRect.h
@@ -26,15 +26,9 @@
// 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 7025e53..cffc46a 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1236,12 +1236,28 @@
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) {