Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 34d6aaa0ab4ddbb9ae5f158a846d77636c326642..8849aba9151f5475dc1a6cec25cdde8e2370375e 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -992,6 +992,8 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav |
flags |= kClipToLayer_SaveFlag; |
#endif |
+ SkImageFilter* imgf = paint ? paint->getImageFilter() : NULL; |
+ |
// do this before we create the layer. We don't call the public save() since |
// that would invoke a possibly overridden virtual |
this->internalSave(); |
@@ -999,7 +1001,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav |
fDeviceCMDirty = true; |
SkIRect ir; |
- if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : NULL)) { |
+ if (!this->clipRectBounds(bounds, flags, &ir, imgf)) { |
return; |
} |
@@ -1013,7 +1015,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav |
SkPixelGeometry geo = fProps.pixelGeometry(); |
if (paint) { |
// TODO: perhaps add a query to filters so we might preserve opaqueness... |
- if (paint->getImageFilter() || paint->getColorFilter()) { |
+ if (imgf || paint->getColorFilter()) { |
isOpaque = false; |
geo = kUnknown_SkPixelGeometry; |
} |
@@ -1029,7 +1031,10 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav |
bool forceSpriteOnRestore = false; |
{ |
- const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage; |
+ SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage; |
+ if (imgf && imgf->mayDrawWithMatrix()) { |
+ usage = SkBaseDevice::kPossible_TileUsage; |
+ } |
const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(info, usage, geo); |
SkBaseDevice* newDev = device->onCreateDevice(createInfo, paint); |
if (NULL == newDev) { |