Index: src/effects/SkRectShaderImageFilter.cpp |
=================================================================== |
--- src/effects/SkRectShaderImageFilter.cpp (revision 8729) |
+++ src/effects/SkRectShaderImageFilter.cpp (working copy) |
@@ -43,16 +43,25 @@ |
} |
bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy, |
- const SkBitmap& source, |
- const SkMatrix& matrix, |
- SkBitmap* result, |
- SkIPoint* loc) { |
- SkAutoTUnref<SkDevice> device(proxy->createDevice(SkScalarCeilToInt(fRect.width()), |
- SkScalarCeilToInt(fRect.height()))); |
+ const SkBitmap& source, |
+ const SkMatrix&, |
+ SkBitmap* result, |
+ SkIPoint*) { |
+ SkRect rect(fRect); |
+ if (rect.isEmpty()) { |
+ rect = SkRect::MakeWH(source.width(), source.height()); |
+ } |
+ |
+ if (rect.isEmpty()) { |
+ return false; |
+ } |
+ |
+ SkAutoTUnref<SkDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()), |
+ SkScalarCeilToInt(rect.height()))); |
SkCanvas canvas(device.get()); |
SkPaint paint; |
paint.setShader(fShader); |
- canvas.drawRect(fRect, paint); |
+ canvas.drawRect(rect, paint); |
*result = device.get()->accessBitmap(false); |
return true; |
} |