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

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

Issue 1701013002: Create GrPathRenderingDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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 | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrDrawingManager.h » ('j') | 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 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrBatchTest.h" 9 #include "GrBatchTest.h"
10 #include "GrColor.h" 10 #include "GrColor.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // when the drawContext attempts to use it (via getDrawTarget). 52 // when the drawContext attempts to use it (via getDrawTarget).
53 GrDrawContext::GrDrawContext(GrContext* context, 53 GrDrawContext::GrDrawContext(GrContext* context,
54 GrDrawingManager* drawingMgr, 54 GrDrawingManager* drawingMgr,
55 GrRenderTarget* rt, 55 GrRenderTarget* rt,
56 const SkSurfaceProps* surfaceProps, 56 const SkSurfaceProps* surfaceProps,
57 GrAuditTrail* auditTrail, 57 GrAuditTrail* auditTrail,
58 GrSingleOwner* singleOwner) 58 GrSingleOwner* singleOwner)
59 : fDrawingManager(drawingMgr) 59 : fDrawingManager(drawingMgr)
60 , fRenderTarget(rt) 60 , fRenderTarget(rt)
61 , fDrawTarget(SkSafeRef(rt->getLastDrawTarget())) 61 , fDrawTarget(SkSafeRef(rt->getLastDrawTarget()))
62 , fTextContext(nullptr) 62 , fAtlasTextContext(nullptr)
63 , fContext(context) 63 , fContext(context)
64 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) 64 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
65 , fAuditTrail(auditTrail) 65 , fAuditTrail(auditTrail)
66 #ifdef SK_DEBUG 66 #ifdef SK_DEBUG
67 , fSingleOwner(singleOwner) 67 , fSingleOwner(singleOwner)
68 #endif 68 #endif
69 { 69 {
70 SkDEBUGCODE(this->validate();) 70 SkDEBUGCODE(this->validate();)
71 } 71 }
72 72
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint, 109 void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint,
110 const SkPaint& skPaint, 110 const SkPaint& skPaint,
111 const SkMatrix& viewMatrix, 111 const SkMatrix& viewMatrix,
112 const char text[], size_t byteLength, 112 const char text[], size_t byteLength,
113 SkScalar x, SkScalar y, const SkIRect& clipBounds) { 113 SkScalar x, SkScalar y, const SkIRect& clipBounds) {
114 ASSERT_SINGLE_OWNER 114 ASSERT_SINGLE_OWNER
115 RETURN_IF_ABANDONED 115 RETURN_IF_ABANDONED
116 SkDEBUGCODE(this->validate();) 116 SkDEBUGCODE(this->validate();)
117 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText"); 117 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText");
118 118
119 if (!fTextContext) { 119 if (!fAtlasTextContext) {
120 fTextContext = fDrawingManager->textContext(fSurfaceProps, fRenderTarget ); 120 fAtlasTextContext = GrAtlasTextContext::Create();
121 } 121 }
122 122
123 fTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatrix, f SurfaceProps, 123 fAtlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatr ix, fSurfaceProps,
124 text, byteLength, x, y, clipBounds); 124 text, byteLength, x, y, clipBounds);
125 } 125 }
126 126
127 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, 127 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
128 const SkPaint& skPaint, 128 const SkPaint& skPaint,
129 const SkMatrix& viewMatrix, 129 const SkMatrix& viewMatrix,
130 const char text[], size_t byteLength, 130 const char text[], size_t byteLength,
131 const SkScalar pos[], int scalarsPerPosition, 131 const SkScalar pos[], int scalarsPerPosition,
132 const SkPoint& offset, const SkIRect& clipBounds ) { 132 const SkPoint& offset, const SkIRect& clipBounds ) {
133 ASSERT_SINGLE_OWNER 133 ASSERT_SINGLE_OWNER
134 RETURN_IF_ABANDONED 134 RETURN_IF_ABANDONED
135 SkDEBUGCODE(this->validate();) 135 SkDEBUGCODE(this->validate();)
136 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText"); 136 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText");
137 137
138 if (!fTextContext) { 138 if (!fAtlasTextContext) {
139 fTextContext = fDrawingManager->textContext(fSurfaceProps, fRenderTarget ); 139 fAtlasTextContext = GrAtlasTextContext::Create();
140 } 140 }
141 141
142 fTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewMatrix , fSurfaceProps, 142 fAtlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewM atrix,
143 text, byteLength, pos, scalarsPerPosition, offset, clipBounds); 143 fSurfaceProps, text, byteLength, pos, scalars PerPosition,
144 offset, clipBounds);
144 145
145 } 146 }
146 147
147 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, 148 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
148 const SkMatrix& viewMatrix, const SkTextBlob* b lob, 149 const SkMatrix& viewMatrix, const SkTextBlob* b lob,
149 SkScalar x, SkScalar y, 150 SkScalar x, SkScalar y,
150 SkDrawFilter* filter, const SkIRect& clipBounds ) { 151 SkDrawFilter* filter, const SkIRect& clipBounds ) {
151 ASSERT_SINGLE_OWNER 152 ASSERT_SINGLE_OWNER
152 RETURN_IF_ABANDONED 153 RETURN_IF_ABANDONED
153 SkDEBUGCODE(this->validate();) 154 SkDEBUGCODE(this->validate();)
154 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob"); 155 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob");
155 156
156 if (!fTextContext) { 157 if (!fAtlasTextContext) {
157 fTextContext = fDrawingManager->textContext(fSurfaceProps, fRenderTarget ); 158 fAtlasTextContext = GrAtlasTextContext::Create();
158 } 159 }
159 160
160 fTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, fSurfa ceProps, blob, x, 161 fAtlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, f SurfaceProps, blob,
161 y, filter, clipBounds); 162 x, y, filter, clipBounds);
162 } 163 }
163 164
164 void GrDrawContext::discard() { 165 void GrDrawContext::discard() {
165 ASSERT_SINGLE_OWNER 166 ASSERT_SINGLE_OWNER
166 RETURN_IF_ABANDONED 167 RETURN_IF_ABANDONED
167 SkDEBUGCODE(this->validate();) 168 SkDEBUGCODE(this->validate();)
168 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::discard"); 169 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::discard");
169 170
170 AutoCheckFlush acf(fDrawingManager); 171 AutoCheckFlush acf(fDrawingManager);
171 this->getDrawTarget()->discard(fRenderTarget); 172 this->getDrawTarget()->discard(fRenderTarget);
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 848 }
848 849
849 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b atch) { 850 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b atch) {
850 ASSERT_SINGLE_OWNER 851 ASSERT_SINGLE_OWNER
851 RETURN_IF_ABANDONED 852 RETURN_IF_ABANDONED
852 SkDEBUGCODE(this->validate();) 853 SkDEBUGCODE(this->validate();)
853 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 854 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
854 855
855 this->getDrawTarget()->drawBatch(*pipelineBuilder, batch); 856 this->getDrawTarget()->drawBatch(*pipelineBuilder, batch);
856 } 857 }
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrDrawingManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698