| 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 #ifndef GrBatchFontCache_DEFINED | 8 #ifndef GrBatchFontCache_DEFINED |
| 9 #define GrBatchFontCache_DEFINED | 9 #define GrBatchFontCache_DEFINED |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 GrBatchFontCache* getBatchFontCache() const { return fBatchFontCache; } | 33 GrBatchFontCache* getBatchFontCache() const { return fBatchFontCache; } |
| 34 | 34 |
| 35 inline GrGlyph* getGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) { | 35 inline GrGlyph* getGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) { |
| 36 GrGlyph* glyph = fCache.find(packed); | 36 GrGlyph* glyph = fCache.find(packed); |
| 37 if (NULL == glyph) { | 37 if (NULL == glyph) { |
| 38 glyph = this->generateGlyph(packed, scaler); | 38 glyph = this->generateGlyph(packed, scaler); |
| 39 } | 39 } |
| 40 return glyph; | 40 return glyph; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // returns true if glyph (or glyph+padding for distance field) | |
| 44 // is too large to ever fit in texture atlas subregions (GrPlots) | |
| 45 bool glyphTooLargeForAtlas(GrGlyph*); | |
| 46 // returns true if glyph successfully added to texture atlas, false otherwis
e | 43 // returns true if glyph successfully added to texture atlas, false otherwis
e |
| 47 bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*); | 44 bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*); |
| 48 | 45 |
| 49 // testing | 46 // testing |
| 50 int countGlyphs() const { return fCache.count(); } | 47 int countGlyphs() const { return fCache.count(); } |
| 51 | 48 |
| 52 // remove any references to this plot | 49 // remove any references to this plot |
| 53 void removeID(GrBatchAtlas::AtlasID); | 50 void removeID(GrBatchAtlas::AtlasID); |
| 54 | 51 |
| 55 // If a TextStrike is abandoned by the cache, then the caller must get a new
strike | 52 // If a TextStrike is abandoned by the cache, then the caller must get a new
strike |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 182 |
| 186 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 183 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
| 187 | 184 |
| 188 GrContext* fContext; | 185 GrContext* fContext; |
| 189 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; | 186 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
| 190 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 187 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
| 191 GrBatchTextStrike* fPreserveStrike; | 188 GrBatchTextStrike* fPreserveStrike; |
| 192 }; | 189 }; |
| 193 | 190 |
| 194 #endif | 191 #endif |
| OLD | NEW |