| Index: src/effects/SkMorphologyImageFilter.cpp
 | 
| diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
 | 
| index 2a0f078c053fd6ed0cc13577668090b7415a6c1c..9e87fe04a41a4c00dbc41898277e0b7d7460e69f 100644
 | 
| --- a/src/effects/SkMorphologyImageFilter.cpp
 | 
| +++ b/src/effects/SkMorphologyImageFilter.cpp
 | 
| @@ -478,18 +478,26 @@
 | 
|      SkASSERT(srcTexture);
 | 
|  
 | 
|      // setup new clip
 | 
| -    const GrClip clip(SkRect::MakeWH(SkIntToScalar(srcTexture->width()),
 | 
| -                                     SkIntToScalar(srcTexture->height())));
 | 
| -
 | 
| -    const SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
 | 
| +    GrClip clip(SkRect::MakeWH(SkIntToScalar(srcTexture->width()),
 | 
| +                               SkIntToScalar(srcTexture->height())));
 | 
| +
 | 
| +    SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
 | 
| +    GrSurfaceDesc desc;
 | 
| +    desc.fFlags = kRenderTarget_GrSurfaceFlag;
 | 
| +    desc.fWidth = rect.width();
 | 
| +    desc.fHeight = rect.height();
 | 
| +    desc.fConfig = kSkia8888_GrPixelConfig;
 | 
|      SkIRect srcRect = rect;
 | 
|  
 | 
|      SkASSERT(radius.width() > 0 || radius.height() > 0);
 | 
|  
 | 
|      if (radius.fWidth > 0) {
 | 
| -        sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
 | 
| -                                                                    rect.width(), rect.height(),
 | 
| -                                                                    kSkia8888_GrPixelConfig));
 | 
| +        GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
 | 
| +        if (!scratch) {
 | 
| +            return nullptr;
 | 
| +        }
 | 
| +        sk_sp<GrDrawContext> dstDrawContext(
 | 
| +                                      context->drawContext(sk_ref_sp(scratch->asRenderTarget())));
 | 
|          if (!dstDrawContext) {
 | 
|              return nullptr;
 | 
|          }
 | 
| @@ -499,18 +507,21 @@
 | 
|                                Gr1DKernelEffect::kX_Direction);
 | 
|          SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
 | 
|                                                dstRect.width(), radius.fHeight);
 | 
| -        GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType
 | 
| -                                ? SK_ColorWHITE
 | 
| -                                : SK_ColorTRANSPARENT;
 | 
| +        GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType ?
 | 
| +                                SK_ColorWHITE :
 | 
| +                                SK_ColorTRANSPARENT;
 | 
|          dstDrawContext->clear(&clearRect, clearColor, false);
 | 
|  
 | 
| -        srcTexture = dstDrawContext->asTexture();
 | 
| +        srcTexture.reset(scratch);
 | 
|          srcRect = dstRect;
 | 
|      }
 | 
|      if (radius.fHeight > 0) {
 | 
| -        sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
 | 
| -                                                                    rect.width(), rect.height(),
 | 
| -                                                                    kSkia8888_GrPixelConfig));
 | 
| +        GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
 | 
| +        if (!scratch) {
 | 
| +            return nullptr;
 | 
| +        }
 | 
| +        sk_sp<GrDrawContext> dstDrawContext(
 | 
| +                                      context->drawContext(sk_ref_sp(scratch->asRenderTarget())));
 | 
|          if (!dstDrawContext) {
 | 
|              return nullptr;
 | 
|          }
 | 
| @@ -519,7 +530,7 @@
 | 
|                                srcRect, dstRect, radius.fHeight, morphType,
 | 
|                                Gr1DKernelEffect::kY_Direction);
 | 
|  
 | 
| -        srcTexture = dstDrawContext->asTexture();
 | 
| +        srcTexture.reset(scratch);
 | 
|      }
 | 
|  
 | 
|      return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
 | 
| 
 |