Index: src/core/SkImageFilterUtils.cpp |
diff --git a/src/core/SkImageFilterUtils.cpp b/src/core/SkImageFilterUtils.cpp |
index a4ce51eb9101f2ceb336738d7c48220bab1e47af..8385fb446ae0726ade2ccfbad3250239e6209211 100644 |
--- a/src/core/SkImageFilterUtils.cpp |
+++ b/src/core/SkImageFilterUtils.cpp |
@@ -23,6 +23,11 @@ bool SkImageFilterUtils::WrapTexture(GrTexture* texture, int width, int height, |
bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter::Proxy* proxy, |
const SkBitmap& src, const SkMatrix& ctm, |
SkBitmap* result, SkIPoint* offset) { |
+ // Ensure that GrContext calls under filterImage and filterImageGPU below will see an identity |
+ // matrix with no clip and that the matrix, clip, and render target set before this function was |
+ // called are restored before we return to the caller. |
+ GrContext* context = src.getTexture()->getContext(); |
+ GrContext::AutoWideOpenIdentityDraw awoid(context, NULL); |
if (!filter) { |
*result = src; |
return true; |
@@ -31,9 +36,7 @@ bool SkImageFilterUtils::GetInputResultGPU(SkImageFilter* filter, SkImageFilter: |
} else { |
if (filter->filterImage(proxy, src, ctm, result, offset)) { |
if (!result->getTexture()) { |
- GrContext* context = ((GrTexture *) src.getTexture())->getContext(); |
- GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, |
- *result, NULL); |
+ GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, *result, NULL); |
result->setPixelRef(new SkGrPixelRef(resultTex))->unref(); |
GrUnlockAndUnrefCachedBitmapTexture(resultTex); |
} |