| 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" |
| 11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
| 12 #include "GrPath.h" | 12 #include "GrPath.h" |
| 13 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
| 14 #include "GrResourceProvider.h" | 14 #include "GrResourceProvider.h" |
| 15 #include "SkAutoKern.h" | 15 #include "SkAutoKern.h" |
| 16 #include "SkDraw.h" | 16 #include "SkDraw.h" |
| 17 #include "SkDrawProcs.h" | 17 #include "SkDrawProcs.h" |
| 18 #include "SkGlyphCache.h" | 18 #include "SkGlyphCache.h" |
| 19 #include "SkGpuDevice.h" | 19 #include "SkGpuDevice.h" |
| 20 #include "SkGrPriv.h" | 20 #include "SkGrPriv.h" |
| 21 #include "SkPath.h" | 21 #include "SkPath.h" |
| 22 #include "SkTextBlobRunIterator.h" |
| 22 #include "SkTextMapStateProc.h" | 23 #include "SkTextMapStateProc.h" |
| 23 #include "SkTextFormatParams.h" | 24 #include "SkTextFormatParams.h" |
| 24 | 25 |
| 25 #include "batches/GrDrawPathBatch.h" | 26 #include "batches/GrDrawPathBatch.h" |
| 26 | 27 |
| 27 template<typename Key, typename Val> static void delete_hash_map_entry(const Key
&, Val* val) { | 28 template<typename Key, typename Val> static void delete_hash_map_entry(const Key
&, Val* val) { |
| 28 SkASSERT(*val); | 29 SkASSERT(*val); |
| 29 delete *val; | 30 delete *val; |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 delete lru; | 198 delete lru; |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 201 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 202 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
| 202 | 203 |
| 203 void GrStencilAndCoverTextContext::TextBlob::init(const SkTextBlob* skBlob, | 204 void GrStencilAndCoverTextContext::TextBlob::init(const SkTextBlob* skBlob, |
| 204 const SkPaint& skPaint) { | 205 const SkPaint& skPaint) { |
| 205 fCpuMemorySize = sizeof(TextBlob); | 206 fCpuMemorySize = sizeof(TextBlob); |
| 206 SkPaint runPaint(skPaint); | 207 SkPaint runPaint(skPaint); |
| 207 for (SkTextBlob::RunIterator iter(skBlob); !iter.done(); iter.next()) { | 208 for (SkTextBlobRunIterator iter(skBlob); !iter.done(); iter.next()) { |
| 208 iter.applyFontToPaint(&runPaint); // No need to re-seed the paint. | 209 iter.applyFontToPaint(&runPaint); // No need to re-seed the paint. |
| 209 TextRun* run = SkNEW_INSERT_AT_LLIST_TAIL(this, TextRun, (runPaint)); | 210 TextRun* run = SkNEW_INSERT_AT_LLIST_TAIL(this, TextRun, (runPaint)); |
| 210 | 211 |
| 211 const char* text = reinterpret_cast<const char*>(iter.glyphs()); | 212 const char* text = reinterpret_cast<const char*>(iter.glyphs()); |
| 212 size_t byteLength = sizeof(uint16_t) * iter.glyphCount(); | 213 size_t byteLength = sizeof(uint16_t) * iter.glyphCount(); |
| 213 const SkPoint& runOffset = iter.offset(); | 214 const SkPoint& runOffset = iter.offset(); |
| 214 | 215 |
| 215 switch (iter.positioning()) { | 216 switch (iter.positioning()) { |
| 216 case SkTextBlob::kDefault_Positioning: | 217 case SkTextBlob::kDefault_Positioning: |
| 217 run->setText(text, byteLength, runOffset.fX, runOffset.fY); | 218 run->setText(text, byteLength, runOffset.fX, runOffset.fY); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 fBuffIdx = 0; | 601 fBuffIdx = 0; |
| 601 } | 602 } |
| 602 | 603 |
| 603 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfInit
ialized() { | 604 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfInit
ialized() { |
| 604 if (!this->isInitialized()) { | 605 if (!this->isInitialized()) { |
| 605 return nullptr; | 606 return nullptr; |
| 606 } | 607 } |
| 607 this->flush(); | 608 this->flush(); |
| 608 return fBuilder->build(); | 609 return fBuilder->build(); |
| 609 } | 610 } |
| OLD | NEW |