Chromium Code Reviews| Index: src/core/SkCanvas.cpp |
| diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
| index 08b09e8e2b6e970b06d93c0449b9af8859573173..c2e36b319157c85ac5cb25e3b15d9f8113d51017 100644 |
| --- a/src/core/SkCanvas.cpp |
| +++ b/src/core/SkCanvas.cpp |
| @@ -791,11 +791,18 @@ static bool bounds_affects_clip(SkCanvas::SaveFlags flags) { |
| } |
| bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags, |
| - SkIRect* intersection) { |
| + SkIRect* intersection, const SkImageFilter* imageFilter) { |
| SkIRect clipBounds; |
| + SkRegion::Op op = SkRegion::kIntersect_Op; |
| if (!this->getClipDeviceBounds(&clipBounds)) { |
| return false; |
| } |
| + |
| + if (imageFilter) { |
| + imageFilter->filterBounds(clipBounds, *fMCRec->fMatrix, &clipBounds); |
| + // Filters may grow the bounds beyond the device bounds. |
| + op = SkRegion::kReplace_Op; |
|
reed1
2014/02/04 15:30:08
Hmm, this make me nervous. I understand that the o
Stephen White
2014/02/04 16:01:41
I'm pretty sure we also need to expand the clip in
|
| + } |
| SkIRect ir; |
| if (NULL != bounds) { |
| SkRect r; |
| @@ -813,11 +820,11 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags, |
| ir = clipBounds; |
| } |
| - fClipStack.clipDevRect(ir, SkRegion::kIntersect_Op); |
| + fClipStack.clipDevRect(ir, op); |
| // early exit if the clip is now empty |
| if (bounds_affects_clip(flags) && |
| - !fMCRec->fRasterClip->op(ir, SkRegion::kIntersect_Op)) { |
| + !fMCRec->fRasterClip->op(ir, op)) { |
| return false; |
| } |
| @@ -841,7 +848,7 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, |
| fDeviceCMDirty = true; |
| SkIRect ir; |
| - if (!this->clipRectBounds(bounds, flags, &ir)) { |
| + if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : NULL)) { |
| return count; |
| } |