OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*); | 39 inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*); |
40 bool getGlyphAtlas(GrGlyph*, GrFontScaler*); | 40 bool getGlyphAtlas(GrGlyph*, GrFontScaler*); |
41 | 41 |
42 // testing | 42 // testing |
43 int countGlyphs() const { return fCache.getArray().count(); } | 43 int countGlyphs() const { return fCache.getArray().count(); } |
44 const GrGlyph* glyphAt(int index) const { | 44 const GrGlyph* glyphAt(int index) const { |
45 return fCache.getArray()[index]; | 45 return fCache.getArray()[index]; |
46 } | 46 } |
47 GrAtlas* getAtlas() const { return fAtlas; } | 47 GrAtlas* getAtlas() const { return fAtlas; } |
48 | 48 |
| 49 // returns true if an atlas was removed |
| 50 bool removeUnusedAtlas(); |
| 51 |
| 52 void markAtlasesUnused(); |
| 53 |
49 public: | 54 public: |
50 // for LRU | 55 // for LRU |
51 GrTextStrike* fPrev; | 56 GrTextStrike* fPrev; |
52 GrTextStrike* fNext; | 57 GrTextStrike* fNext; |
53 | 58 |
54 private: | 59 private: |
55 class Key; | 60 class Key; |
56 GrTHashTable<GrGlyph, Key, 7> fCache; | 61 GrTHashTable<GrGlyph, Key, 7> fCache; |
57 const GrKey* fFontScalerKey; | 62 const GrKey* fFontScalerKey; |
58 GrTAllocPool<GrGlyph> fPool; | 63 GrTAllocPool<GrGlyph> fPool; |
(...skipping 15 matching lines...) Expand all Loading... |
74 public: | 79 public: |
75 GrFontCache(GrGpu*); | 80 GrFontCache(GrGpu*); |
76 ~GrFontCache(); | 81 ~GrFontCache(); |
77 | 82 |
78 inline GrTextStrike* getStrike(GrFontScaler*); | 83 inline GrTextStrike* getStrike(GrFontScaler*); |
79 | 84 |
80 void freeAll(); | 85 void freeAll(); |
81 | 86 |
82 void purgeExceptFor(GrTextStrike*); | 87 void purgeExceptFor(GrTextStrike*); |
83 | 88 |
| 89 // remove an unused atlas and its strike (if necessary) |
| 90 void freeAtlasExceptFor(GrTextStrike*); |
| 91 |
84 // testing | 92 // testing |
85 int countStrikes() const { return fCache.getArray().count(); } | 93 int countStrikes() const { return fCache.getArray().count(); } |
86 const GrTextStrike* strikeAt(int index) const { | 94 const GrTextStrike* strikeAt(int index) const { |
87 return fCache.getArray()[index]; | 95 return fCache.getArray()[index]; |
88 } | 96 } |
89 GrTextStrike* getHeadStrike() const { return fHead; } | 97 GrTextStrike* getHeadStrike() const { return fHead; } |
90 | 98 |
91 #if GR_DEBUG | 99 #if GR_DEBUG |
92 void validate() const; | 100 void validate() const; |
93 #else | 101 #else |
(...skipping 11 matching lines...) Expand all Loading... |
105 | 113 |
106 GrGpu* fGpu; | 114 GrGpu* fGpu; |
107 GrAtlasMgr* fAtlasMgr; | 115 GrAtlasMgr* fAtlasMgr; |
108 | 116 |
109 | 117 |
110 GrTextStrike* generateStrike(GrFontScaler*, const Key&); | 118 GrTextStrike* generateStrike(GrFontScaler*, const Key&); |
111 inline void detachStrikeFromList(GrTextStrike*); | 119 inline void detachStrikeFromList(GrTextStrike*); |
112 }; | 120 }; |
113 | 121 |
114 #endif | 122 #endif |
OLD | NEW |