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