Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/gpu/GrPathRenderingDrawContext.cpp

Issue 1706773002: Fix memory leak (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrPathRenderingDrawContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrPathRenderingDrawContext.h" 8 #include "GrPathRenderingDrawContext.h"
9 9
10 #include "GrDrawingManager.h" 10 #include "GrDrawingManager.h"
11 11
12 #include "text/GrStencilAndCoverTextContext.h" 12 #include "text/GrStencilAndCoverTextContext.h"
13 13
14 #define ASSERT_SINGLE_OWNER \ 14 #define ASSERT_SINGLE_OWNER \
15 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner() );) 15 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner() );)
16 #define RETURN_IF_ABANDONED if (this->drawingManager()->abandoned()) { re turn; } 16 #define RETURN_IF_ABANDONED if (this->drawingManager()->abandoned()) { re turn; }
17 17
18 void GrPathRenderingDrawContext::drawText(const GrClip& clip, const GrPaint& gr Paint, 18 void GrPathRenderingDrawContext::drawText(const GrClip& clip, const GrPaint& gr Paint,
19 const SkPaint& skPaint, 19 const SkPaint& skPaint,
20 const SkMatrix& viewMatrix, const char text[], 20 const SkMatrix& viewMatrix, const char text[],
21 size_t byteLength, SkScalar x, SkScala r y, 21 size_t byteLength, SkScalar x, SkScala r y,
22 const SkIRect& clipBounds) { 22 const SkIRect& clipBounds) {
23 ASSERT_SINGLE_OWNER 23 ASSERT_SINGLE_OWNER
24 RETURN_IF_ABANDONED 24 RETURN_IF_ABANDONED
25 SkDEBUGCODE(this->validate();) 25 SkDEBUGCODE(this->validate();)
26 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::d rawText"); 26 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::d rawText");
27 27
28 if (!fStencilAndCoverTextContext) { 28 if (!fStencilAndCoverTextContext) {
29 fStencilAndCoverTextContext = GrStencilAndCoverTextContext::Create(); 29 fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create() );
30 } 30 }
31 31
32 fStencilAndCoverTextContext->drawText(this->drawingManager()->getContext(), this, clip, grPaint, 32 fStencilAndCoverTextContext->drawText(this->drawingManager()->getContext(), this, clip, grPaint,
33 skPaint, viewMatrix, this->surfaceProp s(), 33 skPaint, viewMatrix, this->surfaceProp s(),
34 text, byteLength, x, y, clipBounds); 34 text, byteLength, x, y, clipBounds);
35 } 35 }
36 36
37 void GrPathRenderingDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, 37 void GrPathRenderingDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
38 const SkPaint& skPaint, 38 const SkPaint& skPaint,
39 const SkMatrix& viewMatrix, const c har text[], 39 const SkMatrix& viewMatrix, const c har text[],
40 size_t byteLength, const SkScalar pos[], 40 size_t byteLength, const SkScalar pos[],
41 int scalarsPerPosition, const SkPoi nt& offset, 41 int scalarsPerPosition, const SkPoi nt& offset,
42 const SkIRect& clipBounds) { 42 const SkIRect& clipBounds) {
43 ASSERT_SINGLE_OWNER 43 ASSERT_SINGLE_OWNER
44 RETURN_IF_ABANDONED 44 RETURN_IF_ABANDONED
45 SkDEBUGCODE(this->validate();) 45 SkDEBUGCODE(this->validate();)
46 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::d rawPosText"); 46 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::d rawPosText");
47 47
48 if (!fStencilAndCoverTextContext) { 48 if (!fStencilAndCoverTextContext) {
49 fStencilAndCoverTextContext = GrStencilAndCoverTextContext::Create(); 49 fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create() );
50 } 50 }
51 51
52 fStencilAndCoverTextContext->drawPosText(this->drawingManager()->getContext( ), this, clip, 52 fStencilAndCoverTextContext->drawPosText(this->drawingManager()->getContext( ), this, clip,
53 grPaint, skPaint, viewMatrix, this- >surfaceProps(), 53 grPaint, skPaint, viewMatrix, this- >surfaceProps(),
54 text, byteLength, pos, scalarsPerPo sition, offset, 54 text, byteLength, pos, scalarsPerPo sition, offset,
55 clipBounds); 55 clipBounds);
56 } 56 }
57 57
58 void GrPathRenderingDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, 58 void GrPathRenderingDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
59 const SkMatrix& viewMatrix, const SkTextBlob* blob, 59 const SkMatrix& viewMatrix, const SkTextBlob* blob,
60 SkScalar x, SkScalar y, 60 SkScalar x, SkScalar y,
61 SkDrawFilter* filter, const SkIRec t& clipBounds) { 61 SkDrawFilter* filter, const SkIRec t& clipBounds) {
62 ASSERT_SINGLE_OWNER 62 ASSERT_SINGLE_OWNER
63 RETURN_IF_ABANDONED 63 RETURN_IF_ABANDONED
64 SkDEBUGCODE(this->validate();) 64 SkDEBUGCODE(this->validate();)
65 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::d rawTextBlob"); 65 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::d rawTextBlob");
66 66
67 if (!fStencilAndCoverTextContext) { 67 if (!fStencilAndCoverTextContext) {
68 fStencilAndCoverTextContext = GrStencilAndCoverTextContext::Create(); 68 fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create() );
69 } 69 }
70 70
71 fStencilAndCoverTextContext->drawTextBlob(this->drawingManager()->getContext (), this, clip, 71 fStencilAndCoverTextContext->drawTextBlob(this->drawingManager()->getContext (), this, clip,
72 skPaint, viewMatrix, this->surface Props(), blob, x, 72 skPaint, viewMatrix, this->surface Props(), blob, x,
73 y, filter, clipBounds); 73 y, filter, clipBounds);
74 } 74 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathRenderingDrawContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698