Index: src/gpu/SkGpuDevice.cpp |
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
index 3fa13a7df9abd6b7b5b5ee220d3f4210ef362b39..7bba41f60aa42f7dc21e2e5ff71500a09076d2ef 100644 |
--- a/src/gpu/SkGpuDevice.cpp |
+++ b/src/gpu/SkGpuDevice.cpp |
@@ -951,8 +951,17 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
GrTexture* filtered; |
if (paint.getMaskFilter()->filterMaskGPU(mask.texture(), maskRect, &filtered, true)) { |
+ // filterMaskGPU gives us ownership of a ref to the result |
SkAutoTUnref<GrTexture> atu(filtered); |
+ // If the scratch texture that we used as the filter src also holds the filter |
+ // result then we must detach so that this texture isn't recycled for a later |
+ // draw. |
+ if (filtered == mask.texture()) { |
+ mask.detach(); |
+ filtered->unref(); // detach transfers GrAutoScratchTexture's ref to us. |
+ } |
+ |
if (draw_mask(fContext, maskRect, &grPaint, filtered)) { |
// This path is completely drawn |
return; |