Index: src/effects/SkTileImageFilter.cpp |
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp |
index c5eace0b74ddd598311af434bb9128cc30437a82..73e5304adb3db2f8a0a87908a5f3e1b0c0d76030 100644 |
--- a/src/effects/SkTileImageFilter.cpp |
+++ b/src/effects/SkTileImageFilter.cpp |
@@ -24,16 +24,24 @@ bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S |
return false; |
} |
- int w = SkScalarTruncToInt(fDstRect.width()); |
- int h = SkScalarTruncToInt(fDstRect.height()); |
+ SkRect dstRect; |
+ ctm.mapRect(&dstRect, fDstRect); |
+ int w = SkScalarCeilToInt(dstRect.width()); |
+ int h = SkScalarCeilToInt(dstRect.height()); |
if (!fSrcRect.width() || !fSrcRect.height() || !w || !h) { |
return false; |
} |
- SkIRect srcRect; |
- fSrcRect.roundOut(&srcRect); |
+ SkRect srcRect; |
+ ctm.mapRect(&srcRect, fSrcRect); |
+ SkIRect srcIRect; |
+ srcRect.roundOut(&srcIRect); |
SkBitmap subset; |
- if (!source.extractSubset(&subset, srcRect)) { |
+ SkIRect bounds; |
+ source.getBounds(&bounds); |
+ if (!srcIRect.intersect(bounds)) { |
+ return true; |
+ } else if (!source.extractSubset(&subset, srcIRect)) { |
return false; |
} |
@@ -41,8 +49,6 @@ bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S |
if (NULL == device.get()) { |
return false; |
} |
- SkIRect bounds; |
- source.getBounds(&bounds); |
SkCanvas canvas(device); |
SkPaint paint; |
paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
@@ -50,7 +56,6 @@ bool SkTileImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, const S |
SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(subset, |
SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode)); |
paint.setShader(shader); |
- SkRect dstRect = fDstRect; |
dstRect.offset(SkIntToScalar(localOffset.fX), SkIntToScalar(localOffset.fY)); |
canvas.drawRect(dstRect, paint); |
*dst = device->accessBitmap(false); |