OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 #ifndef SkGlyphCache_DEFINED | 10 #ifndef SkGlyphCache_DEFINED |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 enum { | 205 enum { |
206 kHashBits = 8, | 206 kHashBits = 8, |
207 kHashCount = 1 << kHashBits, | 207 kHashCount = 1 << kHashBits, |
208 kHashMask = kHashCount - 1 | 208 kHashMask = kHashCount - 1 |
209 }; | 209 }; |
210 SkGlyph* fGlyphHash[kHashCount]; | 210 SkGlyph* fGlyphHash[kHashCount]; |
211 SkTDArray<SkGlyph*> fGlyphArray; | 211 SkTDArray<SkGlyph*> fGlyphArray; |
212 SkChunkAlloc fGlyphAlloc; | 212 SkChunkAlloc fGlyphAlloc; |
213 | 213 |
214 int fMetricsCount, fAdvanceCount; | |
215 | |
216 struct CharGlyphRec { | 214 struct CharGlyphRec { |
217 uint32_t fID; // unichar + subpixel | 215 uint32_t fID; // unichar + subpixel |
218 SkGlyph* fGlyph; | 216 SkGlyph* fGlyph; |
219 }; | 217 }; |
220 // no reason to use the same kHashCount as fGlyphHash, but we do for now | 218 // no reason to use the same kHashCount as fGlyphHash, but we do for now |
221 CharGlyphRec fCharToGlyphHash[kHashCount]; | 219 CharGlyphRec fCharToGlyphHash[kHashCount]; |
222 | 220 |
223 static inline unsigned ID2HashIndex(uint32_t id) { | 221 static inline unsigned ID2HashIndex(uint32_t id) { |
224 id ^= id >> 16; | 222 id ^= id >> 16; |
225 id ^= id >> 8; | 223 id ^= id >> 8; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 267 } |
270 | 268 |
271 private: | 269 private: |
272 SkGlyphCache* fCache; | 270 SkGlyphCache* fCache; |
273 | 271 |
274 static bool DetachProc(const SkGlyphCache*, void*); | 272 static bool DetachProc(const SkGlyphCache*, void*); |
275 }; | 273 }; |
276 #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache) | 274 #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache) |
277 | 275 |
278 #endif | 276 #endif |
OLD | NEW |