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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 private: | 58 private: |
59 class Key; | 59 class Key; |
60 GrTHashTable<GrGlyph, Key, 7> fCache; | 60 GrTHashTable<GrGlyph, Key, 7> fCache; |
61 const GrKey* fFontScalerKey; | 61 const GrKey* fFontScalerKey; |
62 GrTAllocPool<GrGlyph> fPool; | 62 GrTAllocPool<GrGlyph> fPool; |
63 | 63 |
64 GrFontCache* fFontCache; | 64 GrFontCache* fFontCache; |
65 GrAtlasMgr* fAtlasMgr; | 65 GrAtlasMgr* fAtlasMgr; |
66 GrMaskFormat fMaskFormat; | 66 GrMaskFormat fMaskFormat; |
67 #if SK_DISTANCEFIELD_FONTS | |
68 bool fUseDistanceField; | 67 bool fUseDistanceField; |
69 #endif | |
70 | 68 |
71 GrAtlas fAtlas; | 69 GrAtlas fAtlas; |
72 | 70 |
73 GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler); | 71 GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler); |
74 | 72 |
75 friend class GrFontCache; | 73 friend class GrFontCache; |
76 }; | 74 }; |
77 | 75 |
78 class GrFontCache { | 76 class GrFontCache { |
79 public: | 77 public: |
80 GrFontCache(GrGpu*); | 78 GrFontCache(GrGpu*); |
81 ~GrFontCache(); | 79 ~GrFontCache(); |
82 | 80 |
83 #if SK_DISTANCEFIELD_FONTS | |
84 inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField); | 81 inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField); |
85 #else | |
86 inline GrTextStrike* getStrike(GrFontScaler*); | |
87 #endif | |
88 | 82 |
89 void freeAll(); | 83 void freeAll(); |
90 | 84 |
91 // make an unused plot available | 85 // make an unused plot available |
92 bool freeUnusedPlot(GrTextStrike* preserveStrike); | 86 bool freeUnusedPlot(GrTextStrike* preserveStrike); |
93 | 87 |
94 // testing | 88 // testing |
95 int countStrikes() const { return fCache.getArray().count(); } | 89 int countStrikes() const { return fCache.getArray().count(); } |
96 const GrTextStrike* strikeAt(int index) const { | 90 const GrTextStrike* strikeAt(int index) const { |
97 return fCache.getArray()[index]; | 91 return fCache.getArray()[index]; |
(...skipping 30 matching lines...) Expand all Loading... |
128 | 122 |
129 GrGpu* fGpu; | 123 GrGpu* fGpu; |
130 GrAtlasMgr* fAtlasMgr[kAtlasCount]; | 124 GrAtlasMgr* fAtlasMgr[kAtlasCount]; |
131 | 125 |
132 GrTextStrike* generateStrike(GrFontScaler*, const Key&); | 126 GrTextStrike* generateStrike(GrFontScaler*, const Key&); |
133 inline void detachStrikeFromList(GrTextStrike*); | 127 inline void detachStrikeFromList(GrTextStrike*); |
134 void purgeStrike(GrTextStrike* strike); | 128 void purgeStrike(GrTextStrike* strike); |
135 }; | 129 }; |
136 | 130 |
137 #endif | 131 #endif |
OLD | NEW |