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 "GrAtlasTextBlob.h" | 8 #include "GrAtlasTextBlob.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "GrDrawContext.h" | 12 #include "GrDrawContext.h" |
13 #include "GrTextUtils.h" | 13 #include "GrTextUtils.h" |
14 #include "SkColorFilter.h" | 14 #include "SkColorFilter.h" |
15 #include "SkDrawFilter.h" | 15 #include "SkDrawFilter.h" |
| 16 #include "SkGlyphCache.h" |
16 #include "SkTextBlobRunIterator.h" | 17 #include "SkTextBlobRunIterator.h" |
17 #include "batches/GrAtlasTextBatch.h" | 18 #include "batches/GrAtlasTextBatch.h" |
18 | 19 |
| 20 SkGlyphCache* GrAtlasTextBlob::setupCache(int runIndex, |
| 21 const SkSurfaceProps& props, |
| 22 const SkPaint& skPaint, |
| 23 const SkMatrix* viewMatrix, |
| 24 bool noGamma) { |
| 25 GrAtlasTextBlob::Run* run = &fRuns[runIndex]; |
| 26 |
| 27 // if we have an override descriptor for the run, then we should use that |
| 28 SkAutoDescriptor* desc = run->fOverrideDescriptor.get() ? run->fOverrideDesc
riptor.get() : |
| 29 &run->fDescriptor; |
| 30 skPaint.getScalerContextDescriptor(desc, props, viewMatrix, noGamma); |
| 31 run->fTypeface.reset(SkSafeRef(skPaint.getTypeface())); |
| 32 return SkGlyphCache::DetachCache(run->fTypeface, desc->getDesc()); |
| 33 } |
| 34 |
19 void GrAtlasTextBlob::appendGlyph(int runIndex, | 35 void GrAtlasTextBlob::appendGlyph(int runIndex, |
20 const SkRect& positions, | 36 const SkRect& positions, |
21 GrColor color, | 37 GrColor color, |
22 GrBatchTextStrike* strike, | 38 GrBatchTextStrike* strike, |
23 GrGlyph* glyph, | 39 GrGlyph* glyph, |
24 GrFontScaler* scaler, const SkGlyph& skGlyph, | 40 GrFontScaler* scaler, const SkGlyph& skGlyph, |
25 SkScalar x, SkScalar y, SkScalar scale, bool a
pplyVM) { | 41 SkScalar x, SkScalar y, SkScalar scale, bool a
pplyVM) { |
26 | 42 |
27 // If the glyph is too large we fall back to paths | 43 // If the glyph is too large we fall back to paths |
28 if (glyph->fTooLargeForAtlas) { | 44 if (glyph->fTooLargeForAtlas) { |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); | 507 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); |
492 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { | 508 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { |
493 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == | 509 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == |
494 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); | 510 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); |
495 }*/ | 511 }*/ |
496 } | 512 } |
497 } | 513 } |
498 } | 514 } |
499 | 515 |
500 #endif | 516 #endif |
OLD | NEW |