Revert of simplify clip inside a layer -- will be applied in restore (patchset #2...
authorreed <reed@chromium.org>
Wed, 11 Mar 2015 11:02:20 +0000 (04:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 11 Mar 2015 11:02:20 +0000 (04:02 -0700)
Reason for revert:
slight rebaselines needed in layouttests

http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/51755

Original issue's description:
> simplify clip inside a layer -- will be applied in restore
>
> BUG=skia:
> TBR=
> NOTREECHECKS=True
>
> speculative land to measure performance
>
> Committed: https://skia.googlesource.com/skia/+/c275493d4247a2c5ae845d340c4297258f4684bc

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/997103002

src/core/SkCanvas.cpp

index 55e8b4a..e4c03f3 100644 (file)
@@ -833,6 +833,7 @@ static bool bounds_affects_clip(SkCanvas::SaveFlags flags) {
 bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
                                SkIRect* intersection, const SkImageFilter* imageFilter) {
     SkIRect clipBounds;
+    SkRegion::Op op = SkRegion::kIntersect_Op;
     if (!this->getClipDeviceBounds(&clipBounds)) {
         return false;
     }
@@ -841,6 +842,8 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
 
     if (imageFilter) {
         imageFilter->filterBounds(clipBounds, ctm, &clipBounds);
+        // Filters may grow the bounds beyond the device bounds.
+        op = SkRegion::kReplace_Op;
     }
     SkIRect ir;
     if (bounds) {
@@ -860,10 +863,9 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
     }
 
     if (bounds_affects_clip(flags)) {
-        // Simplify the current clips since they will be applied properly during restore()
-        fClipStack->clipDevRect(ir, SkRegion::kReplace_Op);
+        fClipStack->clipDevRect(ir, op);
         // early exit if the clip is now empty
-        if (!fMCRec->fRasterClip.op(ir, SkRegion::kReplace_Op)) {
+        if (!fMCRec->fRasterClip.op(ir, op)) {
             return false;
         }
     }