diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h index 44d5fe4ec5..66ccff7052 100644 --- a/include/gpu/GrDrawContext.h +++ b/include/gpu/GrDrawContext.h @@ -310,17 +310,17 @@ private: GrDrawTarget* getDrawTarget(); - GrDrawingManager* fDrawingManager; - GrRenderTarget* fRenderTarget; + GrDrawingManager* fDrawingManager; + GrRenderTarget* fRenderTarget; // In MDB-mode the drawTarget can be closed by some other drawContext that has picked // it up. For this reason, the drawTarget should only ever be accessed via 'getDrawTarget'. - GrDrawTarget* fDrawTarget; - GrAtlasTextContext* fAtlasTextContext; - GrContext* fContext; + GrDrawTarget* fDrawTarget; + SkAutoTDelete fAtlasTextContext; + GrContext* fContext; - SkSurfaceProps fSurfaceProps; - GrAuditTrail* fAuditTrail; + SkSurfaceProps fSurfaceProps; + GrAuditTrail* fAuditTrail; // In debug builds we guard against improper thread handling SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index f31e0b23b0..67013ff4f1 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -59,7 +59,6 @@ GrDrawContext::GrDrawContext(GrContext* context, : fDrawingManager(drawingMgr) , fRenderTarget(rt) , fDrawTarget(SkSafeRef(rt->getLastDrawTarget())) - , fAtlasTextContext(nullptr) , fContext(context) , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) , fAuditTrail(auditTrail) @@ -117,7 +116,7 @@ void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint, GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText"); if (!fAtlasTextContext) { - fAtlasTextContext = GrAtlasTextContext::Create(); + fAtlasTextContext.reset(GrAtlasTextContext::Create()); } fAtlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatrix, fSurfaceProps, @@ -136,7 +135,7 @@ void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText"); if (!fAtlasTextContext) { - fAtlasTextContext = GrAtlasTextContext::Create(); + fAtlasTextContext.reset(GrAtlasTextContext::Create()); } fAtlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewMatrix, @@ -155,7 +154,7 @@ void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob"); if (!fAtlasTextContext) { - fAtlasTextContext = GrAtlasTextContext::Create(); + fAtlasTextContext.reset(GrAtlasTextContext::Create()); } fAtlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, fSurfaceProps, blob, diff --git a/src/gpu/GrPathRenderingDrawContext.cpp b/src/gpu/GrPathRenderingDrawContext.cpp index a29af843b7..3ca742c873 100644 --- a/src/gpu/GrPathRenderingDrawContext.cpp +++ b/src/gpu/GrPathRenderingDrawContext.cpp @@ -26,7 +26,7 @@ void GrPathRenderingDrawContext::drawText(const GrClip& clip, const GrPaint& gr GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::drawText"); if (!fStencilAndCoverTextContext) { - fStencilAndCoverTextContext = GrStencilAndCoverTextContext::Create(); + fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create()); } fStencilAndCoverTextContext->drawText(this->drawingManager()->getContext(), this, clip, grPaint, @@ -46,7 +46,7 @@ void GrPathRenderingDrawContext::drawPosText(const GrClip& clip, const GrPaint& GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::drawPosText"); if (!fStencilAndCoverTextContext) { - fStencilAndCoverTextContext = GrStencilAndCoverTextContext::Create(); + fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create()); } fStencilAndCoverTextContext->drawPosText(this->drawingManager()->getContext(), this, clip, @@ -65,7 +65,7 @@ void GrPathRenderingDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::drawTextBlob"); if (!fStencilAndCoverTextContext) { - fStencilAndCoverTextContext = GrStencilAndCoverTextContext::Create(); + fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create()); } fStencilAndCoverTextContext->drawTextBlob(this->drawingManager()->getContext(), this, clip, diff --git a/src/gpu/GrPathRenderingDrawContext.h b/src/gpu/GrPathRenderingDrawContext.h index ab36955ae0..49a0e1d3c5 100644 --- a/src/gpu/GrPathRenderingDrawContext.h +++ b/src/gpu/GrPathRenderingDrawContext.h @@ -29,11 +29,10 @@ protected: GrPathRenderingDrawContext(GrContext* ctx, GrDrawingManager* mgr, GrRenderTarget* rt, const SkSurfaceProps* surfaceProps, GrAuditTrail* at, GrSingleOwner* so) - : INHERITED(ctx, mgr, rt, surfaceProps, at, so) - , fStencilAndCoverTextContext(nullptr) {} + : INHERITED(ctx, mgr, rt, surfaceProps, at, so) {} private: - GrStencilAndCoverTextContext* fStencilAndCoverTextContext; + SkAutoTDelete fStencilAndCoverTextContext; friend class GrDrawingManager; // for ctor