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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 202 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
203 | 203 |
204 void GrStencilAndCoverTextContext::TextBlob::init(const SkTextBlob* skBlob, | 204 void GrStencilAndCoverTextContext::TextBlob::init(const SkTextBlob* skBlob, |
205 const SkPaint& skPaint) { | 205 const SkPaint& skPaint) { |
206 fCpuMemorySize = sizeof(TextBlob); | 206 fCpuMemorySize = sizeof(TextBlob); |
207 SkPaint runPaint(skPaint); | 207 SkPaint runPaint(skPaint); |
208 for (SkTextBlobRunIterator iter(skBlob); !iter.done(); iter.next()) { | 208 for (SkTextBlobRunIterator iter(skBlob); !iter.done(); iter.next()) { |
209 iter.applyFontToPaint(&runPaint); // No need to re-seed the paint. | 209 iter.applyFontToPaint(&runPaint); // No need to re-seed the paint. |
210 TextRun* run = SkNEW_INSERT_AT_LLIST_TAIL(this, TextRun, (runPaint)); | 210 TextRun* run = this->addToTail(runPaint); |
211 | 211 |
212 const char* text = reinterpret_cast<const char*>(iter.glyphs()); | 212 const char* text = reinterpret_cast<const char*>(iter.glyphs()); |
213 size_t byteLength = sizeof(uint16_t) * iter.glyphCount(); | 213 size_t byteLength = sizeof(uint16_t) * iter.glyphCount(); |
214 const SkPoint& runOffset = iter.offset(); | 214 const SkPoint& runOffset = iter.offset(); |
215 | 215 |
216 switch (iter.positioning()) { | 216 switch (iter.positioning()) { |
217 case SkTextBlob::kDefault_Positioning: | 217 case SkTextBlob::kDefault_Positioning: |
218 run->setText(text, byteLength, runOffset.fX, runOffset.fY); | 218 run->setText(text, byteLength, runOffset.fX, runOffset.fY); |
219 break; | 219 break; |
220 case SkTextBlob::kHorizontal_Positioning: | 220 case SkTextBlob::kHorizontal_Positioning: |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 fBuffIdx = 0; | 601 fBuffIdx = 0; |
602 } | 602 } |
603 | 603 |
604 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfInit
ialized() { | 604 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfInit
ialized() { |
605 if (!this->isInitialized()) { | 605 if (!this->isInitialized()) { |
606 return nullptr; | 606 return nullptr; |
607 } | 607 } |
608 this->flush(); | 608 this->flush(); |
609 return fBuilder->build(); | 609 return fBuilder->build(); |
610 } | 610 } |
OLD | NEW |