Fix memory leak
TBR=bsalomon@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1706773002 Review URL: https://codereview.chromium.org/1706773002
This commit is contained in:
parent
e06ed25540
commit
8db867820b
@ -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<GrAtlasTextContext> fAtlasTextContext;
|
||||
GrContext* fContext;
|
||||
|
||||
SkSurfaceProps fSurfaceProps;
|
||||
GrAuditTrail* fAuditTrail;
|
||||
SkSurfaceProps fSurfaceProps;
|
||||
GrAuditTrail* fAuditTrail;
|
||||
|
||||
// In debug builds we guard against improper thread handling
|
||||
SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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<GrStencilAndCoverTextContext> fStencilAndCoverTextContext;
|
||||
|
||||
friend class GrDrawingManager; // for ctor
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user