| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrBatchTest.h" | 8 #include "GrBatchTest.h" |
| 9 #include "GrColor.h" | 9 #include "GrColor.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint, | 128 void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint, |
| 129 const SkPaint& skPaint, | 129 const SkPaint& skPaint, |
| 130 const SkMatrix& viewMatrix, | 130 const SkMatrix& viewMatrix, |
| 131 const char text[], size_t byteLength, | 131 const char text[], size_t byteLength, |
| 132 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ | 132 SkScalar x, SkScalar y, 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::drawText"); | 136 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText"); |
| 137 | 137 |
| 138 if (!fAtlasTextContext) { | 138 GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext(
); |
| 139 fAtlasTextContext.reset(GrAtlasTextContext::Create()); | 139 atlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatri
x, fSurfaceProps, |
| 140 } | 140 text, byteLength, x, y, clipBounds); |
| 141 | |
| 142 fAtlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatr
ix, fSurfaceProps, | |
| 143 text, byteLength, x, y, clipBounds); | |
| 144 } | 141 } |
| 145 | 142 |
| 146 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, | 143 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, |
| 147 const SkPaint& skPaint, | 144 const SkPaint& skPaint, |
| 148 const SkMatrix& viewMatrix, | 145 const SkMatrix& viewMatrix, |
| 149 const char text[], size_t byteLength, | 146 const char text[], size_t byteLength, |
| 150 const SkScalar pos[], int scalarsPerPosition, | 147 const SkScalar pos[], int scalarsPerPosition, |
| 151 const SkPoint& offset, const SkIRect& clipBounds
) { | 148 const SkPoint& offset, const SkIRect& clipBounds
) { |
| 152 ASSERT_SINGLE_OWNER | 149 ASSERT_SINGLE_OWNER |
| 153 RETURN_IF_ABANDONED | 150 RETURN_IF_ABANDONED |
| 154 SkDEBUGCODE(this->validate();) | 151 SkDEBUGCODE(this->validate();) |
| 155 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText"); | 152 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText"); |
| 156 | 153 |
| 157 if (!fAtlasTextContext) { | 154 GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext(
); |
| 158 fAtlasTextContext.reset(GrAtlasTextContext::Create()); | 155 atlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewMa
trix, |
| 159 } | 156 fSurfaceProps, text, byteLength, pos, scalarsP
erPosition, |
| 160 | 157 offset, clipBounds); |
| 161 fAtlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewM
atrix, | |
| 162 fSurfaceProps, text, byteLength, pos, scalars
PerPosition, | |
| 163 offset, clipBounds); | |
| 164 | 158 |
| 165 } | 159 } |
| 166 | 160 |
| 167 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, | 161 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, |
| 168 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, | 162 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, |
| 169 SkScalar x, SkScalar y, | 163 SkScalar x, SkScalar y, |
| 170 SkDrawFilter* filter, const SkIRect& clipBounds
) { | 164 SkDrawFilter* filter, const SkIRect& clipBounds
) { |
| 171 ASSERT_SINGLE_OWNER | 165 ASSERT_SINGLE_OWNER |
| 172 RETURN_IF_ABANDONED | 166 RETURN_IF_ABANDONED |
| 173 SkDEBUGCODE(this->validate();) | 167 SkDEBUGCODE(this->validate();) |
| 174 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob"); | 168 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob"); |
| 175 | 169 |
| 176 if (!fAtlasTextContext) { | 170 GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext(
); |
| 177 fAtlasTextContext.reset(GrAtlasTextContext::Create()); | 171 atlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, fS
urfaceProps, blob, |
| 178 } | 172 x, y, filter, clipBounds); |
| 179 | |
| 180 fAtlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, f
SurfaceProps, blob, | |
| 181 x, y, filter, clipBounds); | |
| 182 } | 173 } |
| 183 | 174 |
| 184 void GrDrawContext::discard() { | 175 void GrDrawContext::discard() { |
| 185 ASSERT_SINGLE_OWNER | 176 ASSERT_SINGLE_OWNER |
| 186 RETURN_IF_ABANDONED | 177 RETURN_IF_ABANDONED |
| 187 SkDEBUGCODE(this->validate();) | 178 SkDEBUGCODE(this->validate();) |
| 188 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::discard"); | 179 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::discard"); |
| 189 | 180 |
| 190 AutoCheckFlush acf(fDrawingManager); | 181 AutoCheckFlush acf(fDrawingManager); |
| 191 this->getDrawTarget()->discard(fRenderTarget.get()); | 182 this->getDrawTarget()->discard(fRenderTarget.get()); |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 | 1298 |
| 1308 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1299 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
| 1309 GrDrawBatch* batch) { | 1300 GrDrawBatch* batch) { |
| 1310 ASSERT_SINGLE_OWNER | 1301 ASSERT_SINGLE_OWNER |
| 1311 RETURN_IF_ABANDONED | 1302 RETURN_IF_ABANDONED |
| 1312 SkDEBUGCODE(this->validate();) | 1303 SkDEBUGCODE(this->validate();) |
| 1313 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1304 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 1314 | 1305 |
| 1315 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1306 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 1316 } | 1307 } |
| OLD | NEW |