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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 fx += SkFixedMul(autokern.adjust(glyph), fixedSizeRatio); | 371 fx += SkFixedMul(autokern.adjust(glyph), fixedSizeRatio); |
372 if (glyph.fWidth) { | 372 if (glyph.fWidth) { |
373 this->appendGlyph(glyph, SkPoint::Make(SkFixedToScalar(fx), SkFixedT
oScalar(fy)), | 373 this->appendGlyph(glyph, SkPoint::Make(SkFixedToScalar(fx), SkFixedT
oScalar(fy)), |
374 &fallback); | 374 &fallback); |
375 } | 375 } |
376 | 376 |
377 fx += SkFixedMul(glyph.fAdvanceX, fixedSizeRatio); | 377 fx += SkFixedMul(glyph.fAdvanceX, fixedSizeRatio); |
378 fy += SkFixedMul(glyph.fAdvanceY, fixedSizeRatio); | 378 fy += SkFixedMul(glyph.fAdvanceY, fixedSizeRatio); |
379 } | 379 } |
380 | 380 |
| 381 fDraw->loadGlyphPathsIfNeeded(); |
| 382 |
381 fFallbackTextBlob.reset(fallback.buildIfInitialized()); | 383 fFallbackTextBlob.reset(fallback.buildIfInitialized()); |
382 } | 384 } |
383 | 385 |
384 void GrStencilAndCoverTextContext::TextRun::setPosText(const char text[], size_t
byteLength, | 386 void GrStencilAndCoverTextContext::TextRun::setPosText(const char text[], size_t
byteLength, |
385 const SkScalar pos[], int
scalarsPerPosition, | 387 const SkScalar pos[], int
scalarsPerPosition, |
386 const SkPoint& offset, Gr
Context* ctx, | 388 const SkPoint& offset, Gr
Context* ctx, |
387 const SkSurfaceProps* sur
faceProps) { | 389 const SkSurfaceProps* sur
faceProps) { |
388 SkASSERT(byteLength == 0 || text != nullptr); | 390 SkASSERT(byteLength == 0 || text != nullptr); |
389 SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); | 391 SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); |
390 | 392 |
(...skipping 18 matching lines...) Expand all Loading... |
409 SkPoint tmsLoc; | 411 SkPoint tmsLoc; |
410 tmsProc(pos, &tmsLoc); | 412 tmsProc(pos, &tmsLoc); |
411 SkPoint loc; | 413 SkPoint loc; |
412 alignProc(tmsLoc, glyph, &loc); | 414 alignProc(tmsLoc, glyph, &loc); |
413 | 415 |
414 this->appendGlyph(glyph, loc, &fallback); | 416 this->appendGlyph(glyph, loc, &fallback); |
415 } | 417 } |
416 pos += scalarsPerPosition; | 418 pos += scalarsPerPosition; |
417 } | 419 } |
418 | 420 |
| 421 fDraw->loadGlyphPathsIfNeeded(); |
| 422 |
419 fFallbackTextBlob.reset(fallback.buildIfInitialized()); | 423 fFallbackTextBlob.reset(fallback.buildIfInitialized()); |
420 } | 424 } |
421 | 425 |
422 GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(GrContext* ctx, | 426 GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(GrContext* ctx, |
423 SkGlyphCache* g
lyphCache) { | 427 SkGlyphCache* g
lyphCache) { |
424 SkTypeface* typeface = fUsingRawGlyphPaths ? fFont.getTypeface() | 428 SkTypeface* typeface = fUsingRawGlyphPaths ? fFont.getTypeface() |
425 : glyphCache->getScalerContext()-
>getTypeface(); | 429 : glyphCache->getScalerContext()-
>getTypeface(); |
426 const SkDescriptor* desc = fUsingRawGlyphPaths ? nullptr : &glyphCache->getD
escriptor(); | 430 const SkDescriptor* desc = fUsingRawGlyphPaths ? nullptr : &glyphCache->getD
escriptor(); |
427 | 431 |
428 static const GrUniqueKey::Domain kPathGlyphDomain = GrUniqueKey::GenerateDom
ain(); | 432 static const GrUniqueKey::Domain kPathGlyphDomain = GrUniqueKey::GenerateDom
ain(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 fBuffIdx = 0; | 569 fBuffIdx = 0; |
566 } | 570 } |
567 | 571 |
568 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfInit
ialized() { | 572 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfInit
ialized() { |
569 if (!this->isInitialized()) { | 573 if (!this->isInitialized()) { |
570 return nullptr; | 574 return nullptr; |
571 } | 575 } |
572 this->flush(); | 576 this->flush(); |
573 return fBuilder->build(); | 577 return fBuilder->build(); |
574 } | 578 } |
OLD | NEW |