Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: src/core/SkCanvas.cpp

Issue 23011012: Implement correct clipping for image filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add morphology to the list of ignored tests Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
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;
}
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698