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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return fCache.getArray()[index]; | 89 return fCache.getArray()[index]; |
90 } | 90 } |
91 GrTextStrike* getHeadStrike() const { return fHead; } | 91 GrTextStrike* getHeadStrike() const { return fHead; } |
92 | 92 |
93 #ifdef SK_DEBUG | 93 #ifdef SK_DEBUG |
94 void validate() const; | 94 void validate() const; |
95 #else | 95 #else |
96 void validate() const {} | 96 void validate() const {} |
97 #endif | 97 #endif |
98 | 98 |
99 #ifdef SK_DEVELOPER | |
100 void dump() const; | 99 void dump() const; |
101 #endif | |
102 | 100 |
103 enum AtlasType { | 101 enum AtlasType { |
104 kA8_AtlasType, //!< 1-byte per pixel | 102 kA8_AtlasType, //!< 1-byte per pixel |
105 k565_AtlasType, //!< 2-bytes per pixel | 103 k565_AtlasType, //!< 2-bytes per pixel |
106 k8888_AtlasType, //!< 4-bytes per pixel | 104 k8888_AtlasType, //!< 4-bytes per pixel |
107 | 105 |
108 kLast_AtlasType = k8888_AtlasType | 106 kLast_AtlasType = k8888_AtlasType |
109 }; | 107 }; |
110 static const int kAtlasCount = kLast_AtlasType + 1; | 108 static const int kAtlasCount = kLast_AtlasType + 1; |
111 | 109 |
112 private: | 110 private: |
113 friend class GrFontPurgeListener; | 111 friend class GrFontPurgeListener; |
114 | 112 |
115 class Key; | 113 class Key; |
116 GrTHashTable<GrTextStrike, Key, 8> fCache; | 114 GrTHashTable<GrTextStrike, Key, 8> fCache; |
117 // for LRU | 115 // for LRU |
118 GrTextStrike* fHead; | 116 GrTextStrike* fHead; |
119 GrTextStrike* fTail; | 117 GrTextStrike* fTail; |
120 | 118 |
121 GrGpu* fGpu; | 119 GrGpu* fGpu; |
122 GrAtlasMgr* fAtlasMgr[kAtlasCount]; | 120 GrAtlasMgr* fAtlasMgr[kAtlasCount]; |
123 | 121 |
124 GrTextStrike* generateStrike(GrFontScaler*, const Key&); | 122 GrTextStrike* generateStrike(GrFontScaler*, const Key&); |
125 inline void detachStrikeFromList(GrTextStrike*); | 123 inline void detachStrikeFromList(GrTextStrike*); |
126 void purgeStrike(GrTextStrike* strike); | 124 void purgeStrike(GrTextStrike* strike); |
127 }; | 125 }; |
128 | 126 |
129 #endif | 127 #endif |
OLD | NEW |