| 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 CharGlyphRec fCharToGlyphHash[kHashCount]; | 205 // Dynamically allocated when chars are encountered. |
| 206 SkAutoTDelete<CharGlyphRec> fCharToGlyphHash; |
| 207 |
| 208 CharGlyphRec* getCharGlyphRec(uint32_t id); |
| 206 | 209 |
| 207 static inline unsigned ID2HashIndex(uint32_t id) { | 210 static inline unsigned ID2HashIndex(uint32_t id) { |
| 208 id ^= id >> 16; | 211 id ^= id >> 16; |
| 209 id ^= id >> 8; | 212 id ^= id >> 8; |
| 210 return id & kHashMask; | 213 return id & kHashMask; |
| 211 } | 214 } |
| 212 | 215 |
| 213 // used to track (approx) how much ram is tied-up in this cache | 216 // used to track (approx) how much ram is tied-up in this cache |
| 214 size_t fMemoryUsed; | 217 size_t fMemoryUsed; |
| 215 | 218 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 const SkMatrix* matrix) { | 293 const SkMatrix* matrix) { |
| 291 fCache = paint.detachCache(deviceProperties, matrix, true); | 294 fCache = paint.detachCache(deviceProperties, matrix, true); |
| 292 } | 295 } |
| 293 | 296 |
| 294 private: | 297 private: |
| 295 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} | 298 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {} |
| 296 }; | 299 }; |
| 297 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) | 300 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm
a) |
| 298 | 301 |
| 299 #endif | 302 #endif |
| OLD | NEW |