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

Unified Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 112683004: Bounds fixes for SkXfermodeImageFilter: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add comment to ignored-tests Created 7 years 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 | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkXfermodeImageFilter.cpp
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 3ab52950be3f40227ba975b800bbdb3cdedb27e0..4674ff44abaab59d1bd8193182bc02816c9bc6cf 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -61,21 +61,22 @@ bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
return false;
}
- SkIRect bounds;
+ SkIRect bounds, foregroundBounds;
background.getBounds(&bounds);
+ bounds.offset(backgroundOffset);
+ foreground.getBounds(&foregroundBounds);
+ foregroundBounds.offset(foregroundOffset);
+ bounds.join(foregroundBounds);
if (!applyCropRect(&bounds, ctm)) {
return false;
}
- backgroundOffset.fX -= bounds.left();
- backgroundOffset.fY -= bounds.top();
- foregroundOffset.fX -= bounds.left();
- foregroundOffset.fY -= bounds.top();
SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
if (NULL == device.get()) {
return false;
}
SkCanvas canvas(device);
+ canvas.translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX),
@@ -83,6 +84,9 @@ bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
paint.setXfermode(fMode);
canvas.drawBitmap(foreground, SkIntToScalar(foregroundOffset.fX),
SkIntToScalar(foregroundOffset.fY), &paint);
+ canvas.clipRect(SkRect::Make(foregroundBounds), SkRegion::kDifference_Op);
+ paint.setColor(SK_ColorTRANSPARENT);
+ canvas.drawPaint(paint);
*dst = device->accessBitmap(false);
offset->fX += bounds.left();
offset->fY += bounds.top();
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698