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 | 33 |
34 inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, | 34 inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, |
35 GrFontScaler* scaler) { | 35 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(skGlyph, packed, scaler); | 38 glyph = this->generateGlyph(skGlyph, packed, scaler); |
39 } | 39 } |
40 return glyph; | 40 return glyph; |
41 } | 41 } |
42 | 42 |
43 // 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. If the glyph's |
44 bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*, const SkGlyph&
); | 44 // mask format has changed, then addGlyphToAtlas will draw a clear box. Thi
s will almost never |
| 45 // happen. |
| 46 // TODO we can handle some of these cases if we really want to, but the long
term solution is to |
| 47 // get the actual glyph image itself when we get the glyph metrics. |
| 48 bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*, const SkGlyph&
, |
| 49 GrMaskFormat expectedMaskFormat); |
45 | 50 |
46 // testing | 51 // testing |
47 int countGlyphs() const { return fCache.count(); } | 52 int countGlyphs() const { return fCache.count(); } |
48 | 53 |
49 // remove any references to this plot | 54 // remove any references to this plot |
50 void removeID(GrBatchAtlas::AtlasID); | 55 void removeID(GrBatchAtlas::AtlasID); |
51 | 56 |
52 // If a TextStrike is abandoned by the cache, then the caller must get a new
strike | 57 // If a TextStrike is abandoned by the cache, then the caller must get a new
strike |
53 bool isAbandoned() const { return fIsAbandoned; } | 58 bool isAbandoned() const { return fIsAbandoned; } |
54 | 59 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 196 |
192 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 197 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
193 | 198 |
194 GrContext* fContext; | 199 GrContext* fContext; |
195 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; | 200 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
196 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 201 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
197 GrBatchTextStrike* fPreserveStrike; | 202 GrBatchTextStrike* fPreserveStrike; |
198 }; | 203 }; |
199 | 204 |
200 #endif | 205 #endif |
OLD | NEW |