| OLD | NEW |
| 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 Loading... |
| 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 , fAtlasTextContext(nullptr) | |
| 63 , fContext(context) | 62 , fContext(context) |
| 64 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) | 63 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) |
| 65 , fAuditTrail(auditTrail) | 64 , fAuditTrail(auditTrail) |
| 66 #ifdef SK_DEBUG | 65 #ifdef SK_DEBUG |
| 67 , fSingleOwner(singleOwner) | 66 , fSingleOwner(singleOwner) |
| 68 #endif | 67 #endif |
| 69 { | 68 { |
| 70 SkDEBUGCODE(this->validate();) | 69 SkDEBUGCODE(this->validate();) |
| 71 } | 70 } |
| 72 | 71 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const SkPaint& skPaint, | 109 const SkPaint& skPaint, |
| 111 const SkMatrix& viewMatrix, | 110 const SkMatrix& viewMatrix, |
| 112 const char text[], size_t byteLength, | 111 const char text[], size_t byteLength, |
| 113 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ | 112 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ |
| 114 ASSERT_SINGLE_OWNER | 113 ASSERT_SINGLE_OWNER |
| 115 RETURN_IF_ABANDONED | 114 RETURN_IF_ABANDONED |
| 116 SkDEBUGCODE(this->validate();) | 115 SkDEBUGCODE(this->validate();) |
| 117 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText"); | 116 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText"); |
| 118 | 117 |
| 119 if (!fAtlasTextContext) { | 118 if (!fAtlasTextContext) { |
| 120 fAtlasTextContext = GrAtlasTextContext::Create(); | 119 fAtlasTextContext.reset(GrAtlasTextContext::Create()); |
| 121 } | 120 } |
| 122 | 121 |
| 123 fAtlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatr
ix, fSurfaceProps, | 122 fAtlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatr
ix, fSurfaceProps, |
| 124 text, byteLength, x, y, clipBounds); | 123 text, byteLength, x, y, clipBounds); |
| 125 } | 124 } |
| 126 | 125 |
| 127 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, | 126 void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, |
| 128 const SkPaint& skPaint, | 127 const SkPaint& skPaint, |
| 129 const SkMatrix& viewMatrix, | 128 const SkMatrix& viewMatrix, |
| 130 const char text[], size_t byteLength, | 129 const char text[], size_t byteLength, |
| 131 const SkScalar pos[], int scalarsPerPosition, | 130 const SkScalar pos[], int scalarsPerPosition, |
| 132 const SkPoint& offset, const SkIRect& clipBounds
) { | 131 const SkPoint& offset, const SkIRect& clipBounds
) { |
| 133 ASSERT_SINGLE_OWNER | 132 ASSERT_SINGLE_OWNER |
| 134 RETURN_IF_ABANDONED | 133 RETURN_IF_ABANDONED |
| 135 SkDEBUGCODE(this->validate();) | 134 SkDEBUGCODE(this->validate();) |
| 136 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText"); | 135 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText"); |
| 137 | 136 |
| 138 if (!fAtlasTextContext) { | 137 if (!fAtlasTextContext) { |
| 139 fAtlasTextContext = GrAtlasTextContext::Create(); | 138 fAtlasTextContext.reset(GrAtlasTextContext::Create()); |
| 140 } | 139 } |
| 141 | 140 |
| 142 fAtlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewM
atrix, | 141 fAtlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewM
atrix, |
| 143 fSurfaceProps, text, byteLength, pos, scalars
PerPosition, | 142 fSurfaceProps, text, byteLength, pos, scalars
PerPosition, |
| 144 offset, clipBounds); | 143 offset, clipBounds); |
| 145 | 144 |
| 146 } | 145 } |
| 147 | 146 |
| 148 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, | 147 void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, |
| 149 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, | 148 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, |
| 150 SkScalar x, SkScalar y, | 149 SkScalar x, SkScalar y, |
| 151 SkDrawFilter* filter, const SkIRect& clipBounds
) { | 150 SkDrawFilter* filter, const SkIRect& clipBounds
) { |
| 152 ASSERT_SINGLE_OWNER | 151 ASSERT_SINGLE_OWNER |
| 153 RETURN_IF_ABANDONED | 152 RETURN_IF_ABANDONED |
| 154 SkDEBUGCODE(this->validate();) | 153 SkDEBUGCODE(this->validate();) |
| 155 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob"); | 154 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob"); |
| 156 | 155 |
| 157 if (!fAtlasTextContext) { | 156 if (!fAtlasTextContext) { |
| 158 fAtlasTextContext = GrAtlasTextContext::Create(); | 157 fAtlasTextContext.reset(GrAtlasTextContext::Create()); |
| 159 } | 158 } |
| 160 | 159 |
| 161 fAtlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, f
SurfaceProps, blob, | 160 fAtlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, f
SurfaceProps, blob, |
| 162 x, y, filter, clipBounds); | 161 x, y, filter, clipBounds); |
| 163 } | 162 } |
| 164 | 163 |
| 165 void GrDrawContext::discard() { | 164 void GrDrawContext::discard() { |
| 166 ASSERT_SINGLE_OWNER | 165 ASSERT_SINGLE_OWNER |
| 167 RETURN_IF_ABANDONED | 166 RETURN_IF_ABANDONED |
| 168 SkDEBUGCODE(this->validate();) | 167 SkDEBUGCODE(this->validate();) |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 } | 847 } |
| 849 | 848 |
| 850 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { | 849 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { |
| 851 ASSERT_SINGLE_OWNER | 850 ASSERT_SINGLE_OWNER |
| 852 RETURN_IF_ABANDONED | 851 RETURN_IF_ABANDONED |
| 853 SkDEBUGCODE(this->validate();) | 852 SkDEBUGCODE(this->validate();) |
| 854 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 853 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 855 | 854 |
| 856 this->getDrawTarget()->drawBatch(*pipelineBuilder, batch); | 855 this->getDrawTarget()->drawBatch(*pipelineBuilder, batch); |
| 857 } | 856 } |
| OLD | NEW |