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 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->isGammaCorrect(
), | 168 if (!SkPaintToGrPaint(context, dc, runPaint, viewMatrix, &grPaint)) { |
169 dc->getColorSpace(), &grPaint)) { | |
170 return; | 169 return; |
171 } | 170 } |
172 | 171 |
173 switch (it.positioning()) { | 172 switch (it.positioning()) { |
174 case SkTextBlob::kDefault_Positioning: | 173 case SkTextBlob::kDefault_Positioning: |
175 this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix,
props, | 174 this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix,
props, |
176 (const char *)it.glyphs(), | 175 (const char *)it.glyphs(), |
177 textLen, x + offset.x(), y + offset.y(), clipBoun
ds); | 176 textLen, x + offset.x(), y + offset.y(), clipBoun
ds); |
178 break; | 177 break; |
179 case SkTextBlob::kHorizontal_Positioning: | 178 case SkTextBlob::kHorizontal_Positioning: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 213 } |
215 | 214 |
216 if (drawFilter || skPaint.getPathEffect()) { | 215 if (drawFilter || skPaint.getPathEffect()) { |
217 // This draw can't be cached. | 216 // This draw can't be cached. |
218 this->uncachedDrawTextBlob(context, dc, clip, skPaint, viewMatrix, props
, skBlob, x, y, | 217 this->uncachedDrawTextBlob(context, dc, clip, skPaint, viewMatrix, props
, skBlob, x, y, |
219 drawFilter, clipBounds); | 218 drawFilter, clipBounds); |
220 return; | 219 return; |
221 } | 220 } |
222 | 221 |
223 GrPaint paint; | 222 GrPaint paint; |
224 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->isGammaCorrect(), dc
->getColorSpace(), | 223 if (!SkPaintToGrPaint(context, dc, skPaint, viewMatrix, &paint)) { |
225 &paint)) { | |
226 return; | 224 return; |
227 } | 225 } |
228 | 226 |
229 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); | 227 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); |
230 | 228 |
231 TextBlob::Iter iter(blob); | 229 TextBlob::Iter iter(blob); |
232 for (TextRun* run = iter.get(); run; run = iter.next()) { | 230 for (TextRun* run = iter.get(); run; run = iter.next()) { |
233 // The run's "font" overrides the anti-aliasing of the passed in paint! | 231 // The run's "font" overrides the anti-aliasing of the passed in paint! |
234 paint.setAntiAlias(run->isAntiAlias()); | 232 paint.setAntiAlias(run->isAntiAlias()); |
235 run->draw(context, dc, paint, clip, viewMatrix, props, x, y, | 233 run->draw(context, dc, paint, clip, viewMatrix, props, x, y, |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 733 } |
736 | 734 |
737 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 735 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
738 *count = fCount; | 736 *count = fCount; |
739 if (fCount) { | 737 if (fCount) { |
740 this->flush(); | 738 this->flush(); |
741 return fBuilder->build(); | 739 return fBuilder->build(); |
742 } | 740 } |
743 return nullptr; | 741 return nullptr; |
744 } | 742 } |
OLD | NEW |