aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/xfermodeimagefilter.cpp12
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp22
2 files changed, 19 insertions, 15 deletions
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 90e2dd0c2b..5603c78456 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -183,6 +183,18 @@ protected:
x = 0;
y += fBitmap.height() + MARGIN;
}
+ // Test small fg, large bg with SrcIn with a crop that forces it to full size.
+ // This tests that SkXfermodeImageFilter correctly applies the compositing mode to
+ // the region outside the foreground.
+ mode = SkXfermode::Make(SkXfermode::kSrcIn_Mode);
+ SkImageFilter::CropRect cropRectFull(SkRect::MakeXYWH(0, 0, 80, 80));
+ paint.setImageFilter(SkXfermodeImageFilter::Make(mode, background, cropped, &cropRectFull));
+ DrawClippedPaint(canvas, clipRect, paint, x, y);
+ x += fBitmap.width() + MARGIN;
+ if (x + fBitmap.width() > WIDTH) {
+ x = 0;
+ y += fBitmap.height() + MARGIN;
+ }
}
private:
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;
}