| 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 removeUnusedAtlases(); |
| 51 |
| 49 public: | 52 public: |
| 50 // for LRU | 53 // for LRU |
| 51 GrTextStrike* fPrev; | 54 GrTextStrike* fPrev; |
| 52 GrTextStrike* fNext; | 55 GrTextStrike* fNext; |
| 53 | 56 |
| 54 private: | 57 private: |
| 55 class Key; | 58 class Key; |
| 56 GrTHashTable<GrGlyph, Key, 7> fCache; | 59 GrTHashTable<GrGlyph, Key, 7> fCache; |
| 57 const GrKey* fFontScalerKey; | 60 const GrKey* fFontScalerKey; |
| 58 GrTAllocPool<GrGlyph> fPool; | 61 GrTAllocPool<GrGlyph> fPool; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 74 public: | 77 public: |
| 75 GrFontCache(GrGpu*); | 78 GrFontCache(GrGpu*); |
| 76 ~GrFontCache(); | 79 ~GrFontCache(); |
| 77 | 80 |
| 78 inline GrTextStrike* getStrike(GrFontScaler*); | 81 inline GrTextStrike* getStrike(GrFontScaler*); |
| 79 | 82 |
| 80 void freeAll(); | 83 void freeAll(); |
| 81 | 84 |
| 82 void purgeExceptFor(GrTextStrike*); | 85 void purgeExceptFor(GrTextStrike*); |
| 83 | 86 |
| 87 // remove an unused atlas and its strike (if necessary) |
| 88 void freeAtlasExceptFor(GrTextStrike*); |
| 89 |
| 84 // testing | 90 // testing |
| 85 int countStrikes() const { return fCache.getArray().count(); } | 91 int countStrikes() const { return fCache.getArray().count(); } |
| 86 const GrTextStrike* strikeAt(int index) const { | 92 const GrTextStrike* strikeAt(int index) const { |
| 87 return fCache.getArray()[index]; | 93 return fCache.getArray()[index]; |
| 88 } | 94 } |
| 89 GrTextStrike* getHeadStrike() const { return fHead; } | 95 GrTextStrike* getHeadStrike() const { return fHead; } |
| 90 | 96 |
| 91 #if GR_DEBUG | 97 #if GR_DEBUG |
| 92 void validate() const; | 98 void validate() const; |
| 93 #else | 99 #else |
| (...skipping 11 matching lines...) Expand all Loading... |
| 105 | 111 |
| 106 GrGpu* fGpu; | 112 GrGpu* fGpu; |
| 107 GrAtlasMgr* fAtlasMgr; | 113 GrAtlasMgr* fAtlasMgr; |
| 108 | 114 |
| 109 | 115 |
| 110 GrTextStrike* generateStrike(GrFontScaler*, const Key&); | 116 GrTextStrike* generateStrike(GrFontScaler*, const Key&); |
| 111 inline void detachStrikeFromList(GrTextStrike*); | 117 inline void detachStrikeFromList(GrTextStrike*); |
| 112 }; | 118 }; |
| 113 | 119 |
| 114 #endif | 120 #endif |
| OLD | NEW |