OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" | 8 #include "GrStencilAndCoverTextContext.h" |
9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const GrClip& clip, const GrPaint& p
aint, | 75 const GrClip& clip, const GrPaint& p
aint, |
76 const SkPaint& skPaint, const SkMatr
ix& viewMatrix, | 76 const SkPaint& skPaint, const SkMatr
ix& viewMatrix, |
77 const SkSurfaceProps& props, | 77 const SkSurfaceProps& props, |
78 const char text[], size_t byteLength
, | 78 const char text[], size_t byteLength
, |
79 SkScalar x, SkScalar y, const SkIRec
t& clipBounds) { | 79 SkScalar x, SkScalar y, const SkIRec
t& clipBounds) { |
80 if (context->abandoned()) { | 80 if (context->abandoned()) { |
81 return; | 81 return; |
82 } else if (this->canDraw(skPaint, viewMatrix)) { | 82 } else if (this->canDraw(skPaint, viewMatrix)) { |
83 if (skPaint.getTextSize() > 0) { | 83 if (skPaint.getTextSize() > 0) { |
84 TextRun run(skPaint); | 84 TextRun run(skPaint); |
85 GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget()); | 85 GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled(
)); |
| 86 pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); |
86 run.setText(text, byteLength, x, y); | 87 run.setText(text, byteLength, x, y); |
87 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, | 88 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, |
88 clipBounds, fFallbackTextContext, skPaint); | 89 clipBounds, fFallbackTextContext, skPaint); |
89 } | 90 } |
90 return; | 91 return; |
91 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, | 92 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, |
92 *context->caps()->shaderCaps())) { | 93 *context->caps()->shaderCaps())) { |
93 fFallbackTextContext->drawText(context, dc, clip, paint, skPaint, viewMa
trix, props, text, | 94 fFallbackTextContext->drawText(context, dc, clip, paint, skPaint, viewMa
trix, props, text, |
94 byteLength, x, y, clipBounds); | 95 byteLength, x, y, clipBounds); |
95 return; | 96 return; |
(...skipping 14 matching lines...) Expand all Loading... |
110 size_t byteLength, | 111 size_t byteLength, |
111 const SkScalar pos[], | 112 const SkScalar pos[], |
112 int scalarsPerPosition, | 113 int scalarsPerPosition, |
113 const SkPoint& offset, | 114 const SkPoint& offset, |
114 const SkIRect& clipBounds) { | 115 const SkIRect& clipBounds) { |
115 if (context->abandoned()) { | 116 if (context->abandoned()) { |
116 return; | 117 return; |
117 } else if (this->canDraw(skPaint, viewMatrix)) { | 118 } else if (this->canDraw(skPaint, viewMatrix)) { |
118 if (skPaint.getTextSize() > 0) { | 119 if (skPaint.getTextSize() > 0) { |
119 TextRun run(skPaint); | 120 TextRun run(skPaint); |
120 GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget()); | 121 GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled(
)); |
| 122 pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); |
121 run.setPosText(text, byteLength, pos, scalarsPerPosition, offset); | 123 run.setPosText(text, byteLength, pos, scalarsPerPosition, offset); |
122 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, | 124 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, |
123 clipBounds, fFallbackTextContext, skPaint); | 125 clipBounds, fFallbackTextContext, skPaint); |
124 } | 126 } |
125 return; | 127 return; |
126 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, | 128 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, |
127 *context->caps()->shaderCaps())) { | 129 *context->caps()->shaderCaps())) { |
128 fFallbackTextContext->drawPosText(context, dc, clip, paint, skPaint, vie
wMatrix, props, | 130 fFallbackTextContext->drawPosText(context, dc, clip, paint, skPaint, vie
wMatrix, props, |
129 text, byteLength, pos, | 131 text, byteLength, pos, |
130 scalarsPerPosition, offset, clipBounds
); | 132 scalarsPerPosition, offset, clipBounds
); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 drawFilter, clipBounds); | 220 drawFilter, clipBounds); |
219 return; | 221 return; |
220 } | 222 } |
221 | 223 |
222 GrPaint paint; | 224 GrPaint paint; |
223 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->isGammaCorrect(), &p
aint)) { | 225 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->isGammaCorrect(), &p
aint)) { |
224 return; | 226 return; |
225 } | 227 } |
226 | 228 |
227 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); | 229 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); |
228 GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget()); | 230 GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); |
| 231 pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); |
229 | 232 |
230 TextBlob::Iter iter(blob); | 233 TextBlob::Iter iter(blob); |
231 for (TextRun* run = iter.get(); run; run = iter.next()) { | 234 for (TextRun* run = iter.get(); run; run = iter.next()) { |
232 run->draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMat
rix, props, x, y, | 235 run->draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMat
rix, props, x, y, |
233 clipBounds, fFallbackTextContext, skPaint); | 236 clipBounds, fFallbackTextContext, skPaint); |
234 run->releaseGlyphCache(); | 237 run->releaseGlyphCache(); |
235 } | 238 } |
236 } | 239 } |
237 | 240 |
238 static inline int style_key_cnt(const GrStyle& style) { | 241 static inline int style_key_cnt(const GrStyle& style) { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 } | 733 } |
731 | 734 |
732 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 735 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
733 *count = fCount; | 736 *count = fCount; |
734 if (fCount) { | 737 if (fCount) { |
735 this->flush(); | 738 this->flush(); |
736 return fBuilder->build(); | 739 return fBuilder->build(); |
737 } | 740 } |
738 return nullptr; | 741 return nullptr; |
739 } | 742 } |
OLD | NEW |