aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2016-03-31 08:24:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-31 08:24:30 -0700
commit9db0427423db995618e3bbf6da5dc6d69442436a (patch)
tree5859d33dffbe10425f82e30723828d07c3e32a16 /src
parent2ae4b2e95ddd36ede0d3cbc4d274b6d6618a049d (diff)
Image filters: fix crop rect application in SkXfermodeImageFilter.
The crop rect was being incorrectly applied in SkXfermodeImageFilter: the background and foreground bounds were having the crop rect applied individually to them, and then unioned. The correct approach is to take the union of their bounds, and apply the crop rect to that. (A similar bug in SkMergeImageFilter was fixed a while back.) This is important when applying a compositing mode which affects pixels outside the foreground bounds (e.g., SrcIn, SrcOut). NOTE: this will change the results of the xfermodeimagefilter GM (new test case). GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842033005 Review URL: https://codereview.chromium.org/1842033005
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 3b186039d0..db0b5e59bb 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -64,21 +64,13 @@ bool SkXfermodeImageFilter::onFilterImageDeprecated(Proxy* proxy,
foreground.reset();
}
- SkIRect bounds, foregroundBounds;
- SkIRect foregroundSrcBounds = foreground.bounds();
- foregroundSrcBounds.offset(foregroundOffset);
- if (!applyCropRect(ctx, foregroundSrcBounds, &foregroundBounds)) {
- foregroundBounds.setEmpty();
- foreground.reset();
- }
- SkIRect backgroundSrcBounds = background.bounds();
- backgroundSrcBounds.offset(backgroundOffset);
- if (!applyCropRect(ctx, backgroundSrcBounds, &bounds)) {
- bounds.setEmpty();
- background.reset();
- }
- bounds.join(foregroundBounds);
- if (bounds.isEmpty()) {
+ SkIRect foregroundBounds = foreground.bounds();
+ foregroundBounds.offset(foregroundOffset);
+ SkIRect srcBounds = background.bounds();
+ srcBounds.offset(backgroundOffset);
+ srcBounds.join(foregroundBounds);
+ SkIRect bounds;
+ if (!this->applyCropRect(ctx, srcBounds, &bounds)) {
return false;
}