Bring sk_sp to GrDrawContext
This is split out of: https://codereview.chromium.org/1914883002/ (Refactor drawContext/RenderTarget creation)
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1918003003
Review-Url: https://codereview.chromium.org/1918003003
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 535d55e..3644da4 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -172,7 +172,7 @@
fLegacyBitmap.setInfo(info);
fLegacyBitmap.setPixelRef(pr)->unref();
- fDrawContext.reset(this->context()->drawContext(rt, &this->surfaceProps()));
+ fDrawContext = this->context()->drawContext(sk_ref_sp(rt), &this->surfaceProps());
if (flags & kNeedClear_Flag) {
this->clearAll();
}
@@ -385,7 +385,8 @@
SkPixelRef* pr = new SkGrPixelRef(fLegacyBitmap.info(), fRenderTarget);
fLegacyBitmap.setPixelRef(pr)->unref();
- fDrawContext.reset(this->context()->drawContext(fRenderTarget, &this->surfaceProps()));
+ fDrawContext = this->context()->drawContext(sk_ref_sp(fRenderTarget.get()),
+ &this->surfaceProps());
}
///////////////////////////////////////////////////////////////////////////////
@@ -513,7 +514,7 @@
SkPath path;
path.setIsVolatile(true);
path.addRect(rect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -564,7 +565,7 @@
return;
}
if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext->textureProvider(),
- fDrawContext,
+ fDrawContext.get(),
&grPaint,
fClip,
*draw.fMatrix,
@@ -585,7 +586,7 @@
SkPath path;
path.setIsVolatile(true);
path.addRRect(rect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -631,7 +632,7 @@
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -701,7 +702,7 @@
CHECK_SHOULD_DRAW(draw);
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
fClip, origSrcPath, paint,
*draw.fMatrix, prePathMatrix,
draw.fRC->getBounds(), pathIsMutable);