| 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 "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
| 10 #include "GrBatchTest.h" | 10 #include "GrBatchTest.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 fDrawTarget->copySurface(dst, src, srcRect, dstPoint); | 58 fDrawTarget->copySurface(dst, src, srcRect, dstPoint); |
| 59 } | 59 } |
| 60 | 60 |
| 61 GrTextContext* GrDrawContext::createTextContext(GrRenderTarget* renderTarget, | 61 GrTextContext* GrDrawContext::createTextContext(GrRenderTarget* renderTarget, |
| 62 const SkSurfaceProps& surfacePro
ps) { | 62 const SkSurfaceProps& surfacePro
ps) { |
| 63 if (fContext->caps()->shaderCaps()->pathRenderingSupport() && | 63 if (fContext->caps()->shaderCaps()->pathRenderingSupport() && |
| 64 renderTarget->isStencilBufferMultisampled() && | 64 renderTarget->isStencilBufferMultisampled() && |
| 65 fSurfaceProps.isUseDeviceIndependentFonts()) { | 65 fSurfaceProps.isUseDeviceIndependentFonts()) { |
| 66 GrStencilAttachment* sb = renderTarget->renderTargetPriv().attachStencil
Attachment(); | 66 GrStencilAttachment* sb = renderTarget->renderTargetPriv().attachStencil
Attachment(); |
| 67 if (sb) { | 67 if (sb) { |
| 68 return GrStencilAndCoverTextContext::Create(fContext, this, surfaceP
rops); | 68 return GrStencilAndCoverTextContext::Create(fContext, surfaceProps); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 return GrAtlasTextContext::Create(fContext, this, surfaceProps); | 72 return GrAtlasTextContext::Create(fContext, surfaceProps); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void GrDrawContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai
nt& grPaint, | 75 void GrDrawContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai
nt& grPaint, |
| 76 const SkPaint& skPaint, | 76 const SkPaint& skPaint, |
| 77 const SkMatrix& viewMatrix, | 77 const SkMatrix& viewMatrix, |
| 78 const char text[], size_t byteLength, | 78 const char text[], size_t byteLength, |
| 79 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ | 79 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ |
| 80 if (!fTextContext) { | 80 if (!fTextContext) { |
| 81 fTextContext = this->createTextContext(rt, fSurfaceProps); | 81 fTextContext = this->createTextContext(rt, fSurfaceProps); |
| 82 } | 82 } |
| 83 | 83 |
| 84 fTextContext->drawText(rt, clip, grPaint, skPaint, viewMatrix, | 84 fTextContext->drawText(this, rt, clip, grPaint, skPaint, viewMatrix, |
| 85 text, byteLength, x, y, clipBounds); | 85 text, byteLength, x, y, clipBounds); |
| 86 | 86 |
| 87 } | 87 } |
| 88 void GrDrawContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr
Paint& grPaint, | 88 void GrDrawContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr
Paint& grPaint, |
| 89 const SkPaint& skPaint, | 89 const SkPaint& skPaint, |
| 90 const SkMatrix& viewMatrix, | 90 const SkMatrix& viewMatrix, |
| 91 const char text[], size_t byteLength, | 91 const char text[], size_t byteLength, |
| 92 const SkScalar pos[], int scalarsPerPosition, | 92 const SkScalar pos[], int scalarsPerPosition, |
| 93 const SkPoint& offset, const SkIRect& clipBounds
) { | 93 const SkPoint& offset, const SkIRect& clipBounds
) { |
| 94 if (!fTextContext) { | 94 if (!fTextContext) { |
| 95 fTextContext = this->createTextContext(rt, fSurfaceProps); | 95 fTextContext = this->createTextContext(rt, fSurfaceProps); |
| 96 } | 96 } |
| 97 | 97 |
| 98 fTextContext->drawPosText(rt, clip, grPaint, skPaint, viewMatrix, text, byte
Length, | 98 fTextContext->drawPosText(this, rt, clip, grPaint, skPaint, viewMatrix, text
, byteLength, |
| 99 pos, scalarsPerPosition, offset, clipBounds); | 99 pos, scalarsPerPosition, offset, clipBounds); |
| 100 | 100 |
| 101 } | 101 } |
| 102 void GrDrawContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S
kPaint& skPaint, | 102 void GrDrawContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S
kPaint& skPaint, |
| 103 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, | 103 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, |
| 104 SkScalar x, SkScalar y, | 104 SkScalar x, SkScalar y, |
| 105 SkDrawFilter* filter, const SkIRect& clipBounds
) { | 105 SkDrawFilter* filter, const SkIRect& clipBounds
) { |
| 106 if (!fTextContext) { | 106 if (!fTextContext) { |
| 107 fTextContext = this->createTextContext(rt, fSurfaceProps); | 107 fTextContext = this->createTextContext(rt, fSurfaceProps); |
| 108 } | 108 } |
| 109 | 109 |
| 110 fTextContext->drawTextBlob(rt, clip, skPaint, viewMatrix, blob, x, y, filter
, clipBounds); | 110 fTextContext->drawTextBlob(this, rt, |
| 111 clip, skPaint, viewMatrix, blob, x, y, filter, cl
ipBounds); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void GrDrawContext::drawPaths(GrPipelineBuilder* pipelineBuilder, | 114 void GrDrawContext::drawPaths(GrPipelineBuilder* pipelineBuilder, |
| 114 const GrPathProcessor* pathProc, | 115 const GrPathProcessor* pathProc, |
| 115 const GrPathRange* pathRange, | 116 const GrPathRange* pathRange, |
| 116 const void* indices, | 117 const void* indices, |
| 117 int /*GrDrawTarget::PathIndexType*/ indexType, | 118 int /*GrDrawTarget::PathIndexType*/ indexType, |
| 118 const float transformValues[], | 119 const float transformValues[], |
| 119 int /*GrDrawTarget::PathTransformType*/ transformT
ype, | 120 int /*GrDrawTarget::PathTransformType*/ transformT
ype, |
| 120 int count, | 121 int count, |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 RETURN_FALSE_IF_ABANDONED | 761 RETURN_FALSE_IF_ABANDONED |
| 761 | 762 |
| 762 ASSERT_OWNED_RESOURCE(rt); | 763 ASSERT_OWNED_RESOURCE(rt); |
| 763 SkASSERT(rt); | 764 SkASSERT(rt); |
| 764 return true; | 765 return true; |
| 765 } | 766 } |
| 766 | 767 |
| 767 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { | 768 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
atch) { |
| 768 fDrawTarget->drawBatch(*pipelineBuilder, batch); | 769 fDrawTarget->drawBatch(*pipelineBuilder, batch); |
| 769 } | 770 } |
| OLD | NEW |