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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { | 159 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { |
160 // A false return from filter() means we should abort the current dr
aw. | 160 // A false return from filter() means we should abort the current dr
aw. |
161 runPaint = skPaint; | 161 runPaint = skPaint; |
162 continue; | 162 continue; |
163 } | 163 } |
164 | 164 |
165 runPaint.setFlags(GrTextUtils::FilterTextFlags(props, runPaint)); | 165 runPaint.setFlags(GrTextUtils::FilterTextFlags(props, runPaint)); |
166 | 166 |
167 GrPaint grPaint; | 167 GrPaint grPaint; |
168 if (!SkPaintToGrPaint(context, runPaint, viewMatrix, dc->allowSRGBInputs
(), &grPaint)) { | 168 if (!SkPaintToGrPaint(context, runPaint, viewMatrix, dc->isGammaCorrect(
), &grPaint)) { |
169 return; | 169 return; |
170 } | 170 } |
171 | 171 |
172 switch (it.positioning()) { | 172 switch (it.positioning()) { |
173 case SkTextBlob::kDefault_Positioning: | 173 case SkTextBlob::kDefault_Positioning: |
174 this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix,
props, | 174 this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix,
props, |
175 (const char *)it.glyphs(), | 175 (const char *)it.glyphs(), |
176 textLen, x + offset.x(), y + offset.y(), clipBoun
ds); | 176 textLen, x + offset.x(), y + offset.y(), clipBoun
ds); |
177 break; | 177 break; |
178 case SkTextBlob::kHorizontal_Positioning: | 178 case SkTextBlob::kHorizontal_Positioning: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 if (drawFilter || skPaint.getPathEffect()) { | 215 if (drawFilter || skPaint.getPathEffect()) { |
216 // This draw can't be cached. | 216 // This draw can't be cached. |
217 this->uncachedDrawTextBlob(context, dc, clip, skPaint, viewMatrix, props
, skBlob, x, y, | 217 this->uncachedDrawTextBlob(context, dc, clip, skPaint, viewMatrix, props
, skBlob, x, y, |
218 drawFilter, clipBounds); | 218 drawFilter, clipBounds); |
219 return; | 219 return; |
220 } | 220 } |
221 | 221 |
222 GrPaint paint; | 222 GrPaint paint; |
223 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->allowSRGBInputs(), &
paint)) { | 223 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->isGammaCorrect(), &p
aint)) { |
224 return; | 224 return; |
225 } | 225 } |
226 | 226 |
227 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); | 227 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); |
228 GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip); | 228 GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip); |
229 | 229 |
230 TextBlob::Iter iter(blob); | 230 TextBlob::Iter iter(blob); |
231 for (TextRun* run = iter.get(); run; run = iter.next()) { | 231 for (TextRun* run = iter.get(); run; run = iter.next()) { |
232 run->draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, p
rops, x, y, | 232 run->draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, p
rops, x, y, |
233 clipBounds, fFallbackTextContext, skPaint); | 233 clipBounds, fFallbackTextContext, skPaint); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 } | 703 } |
704 | 704 |
705 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 705 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
706 *count = fCount; | 706 *count = fCount; |
707 if (fCount) { | 707 if (fCount) { |
708 this->flush(); | 708 this->flush(); |
709 return fBuilder->build(); | 709 return fBuilder->build(); |
710 } | 710 } |
711 return nullptr; | 711 return nullptr; |
712 } | 712 } |
OLD | NEW |