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 "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // applyFontToPaint() always overwrites the exact same attributes, | 152 // applyFontToPaint() always overwrites the exact same attributes, |
153 // so it is safe to not re-seed the paint for this reason. | 153 // so it is safe to not re-seed the paint for this reason. |
154 it.applyFontToPaint(&runPaint); | 154 it.applyFontToPaint(&runPaint); |
155 | 155 |
156 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { | 156 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { |
157 // A false return from filter() means we should abort the current dr
aw. | 157 // A false return from filter() means we should abort the current dr
aw. |
158 runPaint = skPaint; | 158 runPaint = skPaint; |
159 continue; | 159 continue; |
160 } | 160 } |
161 | 161 |
162 runPaint.setFlags(FilterTextFlags(props, runPaint)); | 162 runPaint.setFlags(GrTextUtils::FilterTextFlags(props, runPaint)); |
163 | 163 |
164 GrPaint grPaint; | 164 GrPaint grPaint; |
165 if (!SkPaintToGrPaint(context, runPaint, viewMatrix, &grPaint)) { | 165 if (!SkPaintToGrPaint(context, runPaint, viewMatrix, &grPaint)) { |
166 return; | 166 return; |
167 } | 167 } |
168 | 168 |
169 switch (it.positioning()) { | 169 switch (it.positioning()) { |
170 case SkTextBlob::kDefault_Positioning: | 170 case SkTextBlob::kDefault_Positioning: |
171 this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix,
props, | 171 this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix,
props, |
172 (const char *)it.glyphs(), | 172 (const char *)it.glyphs(), |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } | 565 } |
566 | 566 |
567 void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, | 567 void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, |
568 GrDrawContext* dc, | 568 GrDrawContext* dc, |
569 GrPipelineBuilder* pipelineBuil
der, | 569 GrPipelineBuilder* pipelineBuil
der, |
570 GrColor color, | 570 GrColor color, |
571 const SkMatrix& viewMatrix, | 571 const SkMatrix& viewMatrix, |
572 const SkSurfaceProps& props, | 572 const SkSurfaceProps& props, |
573 SkScalar x, SkScalar y, | 573 SkScalar x, SkScalar y, |
574 const SkIRect& clipBounds, | 574 const SkIRect& clipBounds, |
575 GrTextContext* fallbackTextCont
ext, | 575 GrAtlasTextContext* fallbackTex
tContext, |
576 const SkPaint& originalSkPaint)
const { | 576 const SkPaint& originalSkPaint)
const { |
577 SkASSERT(fInstanceData); | 577 SkASSERT(fInstanceData); |
578 SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.i
sAntiAlias()); | 578 SkASSERT(dc->accessRenderTarget()->isStencilBufferMultisampled() || !fFont.i
sAntiAlias()); |
579 | 579 |
580 if (fInstanceData->count()) { | 580 if (fInstanceData->count()) { |
581 pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.is
AntiAlias()); | 581 pipelineBuilder->setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.is
AntiAlias()); |
582 | 582 |
583 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 583 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
584 kZero_StencilOp, | 584 kZero_StencilOp, |
585 kKeep_StencilOp, | 585 kKeep_StencilOp, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 697 } |
698 | 698 |
699 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 699 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
700 *count = fCount; | 700 *count = fCount; |
701 if (fCount) { | 701 if (fCount) { |
702 this->flush(); | 702 this->flush(); |
703 return fBuilder->build(); | 703 return fBuilder->build(); |
704 } | 704 } |
705 return nullptr; | 705 return nullptr; |
706 } | 706 } |
OLD | NEW |