diff options
author | robertphillips <robertphillips@google.com> | 2015-11-23 09:00:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-23 09:00:05 -0800 |
commit | 125f19a2964c31a660256132acbce60e8a3e6752 (patch) | |
tree | a4ba8888c8d044487221f4a10cd21d389b591c6c /src/core/SkRasterClip.cpp | |
parent | 2b46913c99319de9567390e8a543057be0c162e3 (diff) |
Avoid devolving to a path when conservative clipping with RRects
Review URL: https://codereview.chromium.org/1461923004
Diffstat (limited to 'src/core/SkRasterClip.cpp')
-rw-r--r-- | src/core/SkRasterClip.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp index 89c22e8601..ea1a7db429 100644 --- a/src/core/SkRasterClip.cpp +++ b/src/core/SkRasterClip.cpp @@ -161,10 +161,19 @@ bool SkRasterClip::setPath(const SkPath& path, const SkRegion& clip, bool doAA) return this->updateCacheAndReturnNonEmpty(); } +bool SkRasterClip::op(const SkRRect& rrect, const SkISize& size, SkRegion::Op op, bool doAA) { + if (fForceConservativeRects) { + return this->op(rrect.getBounds(), size, op, doAA); + } + + SkPath path; + path.addRRect(rrect); + + return this->op(path, size, op, doAA); +} + bool SkRasterClip::op(const SkPath& path, const SkISize& size, SkRegion::Op op, bool doAA) { - // base is used to limit the size (and therefore memory allocation) of the - // region that results from scan converting devPath. - SkRegion base; + AUTO_RASTERCLIP_VALIDATE(*this); if (fForceConservativeRects) { SkIRect ir; @@ -181,6 +190,10 @@ bool SkRasterClip::op(const SkPath& path, const SkISize& size, SkRegion::Op op, return this->op(ir, op); } + // base is used to limit the size (and therefore memory allocation) of the + // region that results from scan converting devPath. + SkRegion base; + if (SkRegion::kIntersect_Op == op) { // since we are intersect, we can do better (tighter) with currRgn's // bounds, than just using the device. However, if currRgn is complex, |