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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 }; | 195 }; |
196 SkGlyph* fGlyphHash[kHashCount]; | 196 SkGlyph* fGlyphHash[kHashCount]; |
197 SkTDArray<SkGlyph*> fGlyphArray; | 197 SkTDArray<SkGlyph*> fGlyphArray; |
198 SkChunkAlloc fGlyphAlloc; | 198 SkChunkAlloc fGlyphAlloc; |
199 | 199 |
200 struct CharGlyphRec { | 200 struct CharGlyphRec { |
201 uint32_t fID; // unichar + subpixel | 201 uint32_t fID; // unichar + subpixel |
202 SkGlyph* fGlyph; | 202 SkGlyph* fGlyph; |
203 }; | 203 }; |
204 // no reason to use the same kHashCount as fGlyphHash, but we do for now | 204 // no reason to use the same kHashCount as fGlyphHash, but we do for now |
205 // Dynamically allocated when chars are encountered. | 205 CharGlyphRec fCharToGlyphHash[kHashCount]; |
206 SkAutoTDelete<CharGlyphRec> fCharToGlyphHash; | |
207 | |
208 CharGlyphRec* getCharGlyphRec(uint32_t id); | |
209 | 206 |
210 static inline unsigned ID2HashIndex(uint32_t id) { | 207 static inline unsigned ID2HashIndex(uint32_t id) { |
211 id ^= id >> 16; | 208 id ^= id >> 16; |
212 id ^= id >> 8; | 209 id ^= id >> 8; |
213 return id & kHashMask; | 210 return id & kHashMask; |
214 } | 211 } |
215 | 212 |
216 // used to track (approx) how much ram is tied-up in this cache | 213 // used to track (approx) how much ram is tied-up in this cache |
217 size_t fMemoryUsed; | 214 size_t fMemoryUsed; |
218 | 215 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 const SkMatrix* matrix) { | 290 const SkMatrix* matrix) { |
294 fCache = paint.detachCache(deviceProperties, matrix, true); | 291 fCache = paint.detachCache(deviceProperties, matrix, true); |
295 } | 292 } |
296 | 293 |
297 private: | 294 private: |
298 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} | 295 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} |
299 }; | 296 }; |
300 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) | 297 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) |
301 | 298 |
302 #endif | 299 #endif |
OLD | NEW |