Index: src/effects/SkDisplacementMapEffect.cpp |
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp |
index cf9e2c3c9f9a77531b4ea751f87797e008146df0..797bd972dd9850f979991127bf42cc2eb21392f0 100644 |
--- a/src/effects/SkDisplacementMapEffect.cpp |
+++ b/src/effects/SkDisplacementMapEffect.cpp |
@@ -317,6 +317,17 @@ |
return nullptr; |
} |
+ GrSurfaceDesc desc; |
+ desc.fFlags = kRenderTarget_GrSurfaceFlag; |
+ desc.fWidth = bounds.width(); |
+ desc.fHeight = bounds.height(); |
+ desc.fConfig = kSkia8888_GrPixelConfig; |
+ |
+ sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc)); |
+ if (!dst) { |
+ return nullptr; |
+ } |
+ |
GrPaint paint; |
SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displTexture.get()); |
offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displOffset.fX), |
@@ -335,9 +346,7 @@ |
SkMatrix matrix; |
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y())); |
- sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit, |
- bounds.width(), bounds.height(), |
- kSkia8888_GrPixelConfig)); |
+ sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget()))); |
if (!drawContext) { |
return nullptr; |
} |
@@ -348,7 +357,7 @@ |
offset->fY = bounds.top(); |
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()), |
kNeedNewImageUniqueID_SpecialImage, |
- drawContext->asTexture()); |
+ std::move(dst)); |
} |
#endif |