OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTextUtils.h" | 8 #include "GrTextUtils.h" |
9 | 9 |
10 #include "GrAtlasTextBlob.h" | 10 #include "GrAtlasTextBlob.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 SkPaint::GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(true); | 510 SkPaint::GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(true); |
511 SkAutoGlyphCache autoCache(paint, &props, nullptr); | 511 SkAutoGlyphCache autoCache(paint, &props, nullptr); |
512 SkGlyphCache* cache = autoCache.getCache(); | 512 SkGlyphCache* cache = autoCache.getCache(); |
513 | 513 |
514 const char* stop = text + byteLength; | 514 const char* stop = text + byteLength; |
515 SkTextAlignProc alignProc(paint.getTextAlign()); | 515 SkTextAlignProc alignProc(paint.getTextAlign()); |
516 SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); | 516 SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); |
517 | 517 |
518 // Now restore the original settings, so we "draw" with whatever style/strok
ing. | 518 // Now restore the original settings, so we "draw" with whatever style/strok
ing. |
519 paint.setStyle(origPaint.getStyle()); | 519 paint.setStyle(origPaint.getStyle()); |
520 paint.setPathEffect(origPaint.getPathEffect()); | 520 paint.setPathEffect(sk_ref_sp(origPaint.getPathEffect())); |
521 | 521 |
522 while (text < stop) { | 522 while (text < stop) { |
523 const SkGlyph& glyph = glyphCacheProc(cache, &text); | 523 const SkGlyph& glyph = glyphCacheProc(cache, &text); |
524 if (glyph.fWidth) { | 524 if (glyph.fWidth) { |
525 const SkPath* path = cache->findPath(glyph); | 525 const SkPath* path = cache->findPath(glyph); |
526 if (path) { | 526 if (path) { |
527 SkPoint tmsLoc; | 527 SkPoint tmsLoc; |
528 tmsProc(pos, &tmsLoc); | 528 tmsProc(pos, &tmsLoc); |
529 SkPoint loc; | 529 SkPoint loc; |
530 alignProc(tmsLoc, glyph, &loc); | 530 alignProc(tmsLoc, glyph, &loc); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { | 575 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { |
576 scaler = (GrFontScaler*)auxData; | 576 scaler = (GrFontScaler*)auxData; |
577 } | 577 } |
578 if (nullptr == scaler) { | 578 if (nullptr == scaler) { |
579 scaler = new GrFontScaler(cache); | 579 scaler = new GrFontScaler(cache); |
580 cache->setAuxProc(glyph_cache_aux_proc, scaler); | 580 cache->setAuxProc(glyph_cache_aux_proc, scaler); |
581 } | 581 } |
582 | 582 |
583 return scaler; | 583 return scaler; |
584 } | 584 } |
OLD | NEW |