| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 void forget() { | 180 void forget() { |
| 181 fCache = NULL; | 181 fCache = NULL; |
| 182 } | 182 } |
| 183 private: | 183 private: |
| 184 const SkGlyphCache* fCache; | 184 const SkGlyphCache* fCache; |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 private: | 187 private: |
| 188 SkGlyphCache(SkTypeface*, const SkDescriptor*); | 188 // we take ownership of the scalercontext |
| 189 SkGlyphCache(SkTypeface*, const SkDescriptor*, SkScalerContext*); |
| 189 ~SkGlyphCache(); | 190 ~SkGlyphCache(); |
| 190 | 191 |
| 191 enum MetricsType { | 192 enum MetricsType { |
| 192 kJustAdvance_MetricsType, | 193 kJustAdvance_MetricsType, |
| 193 kFull_MetricsType | 194 kFull_MetricsType |
| 194 }; | 195 }; |
| 195 | 196 |
| 196 SkGlyph* lookupMetrics(uint32_t id, MetricsType); | 197 SkGlyph* lookupMetrics(uint32_t id, MetricsType); |
| 197 static bool DetachProc(const SkGlyphCache*, void*) { return true; } | 198 static bool DetachProc(const SkGlyphCache*, void*) { return true; } |
| 198 | 199 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 216 } | 217 } |
| 217 *head = this; | 218 *head = this; |
| 218 } | 219 } |
| 219 | 220 |
| 220 SkGlyphCache* fNext, *fPrev; | 221 SkGlyphCache* fNext, *fPrev; |
| 221 SkDescriptor* fDesc; | 222 SkDescriptor* fDesc; |
| 222 SkScalerContext* fScalerContext; | 223 SkScalerContext* fScalerContext; |
| 223 SkPaint::FontMetrics fFontMetrics; | 224 SkPaint::FontMetrics fFontMetrics; |
| 224 | 225 |
| 225 enum { | 226 enum { |
| 226 kHashBits = 12, | 227 kHashBits = 8, |
| 227 kHashCount = 1 << kHashBits, | 228 kHashCount = 1 << kHashBits, |
| 228 kHashMask = kHashCount - 1 | 229 kHashMask = kHashCount - 1 |
| 229 }; | 230 }; |
| 230 SkGlyph* fGlyphHash[kHashCount]; | 231 SkGlyph* fGlyphHash[kHashCount]; |
| 231 SkTDArray<SkGlyph*> fGlyphArray; | 232 SkTDArray<SkGlyph*> fGlyphArray; |
| 232 SkChunkAlloc fGlyphAlloc; | 233 SkChunkAlloc fGlyphAlloc; |
| 233 | 234 |
| 234 int fMetricsCount, fAdvanceCount; | 235 int fMetricsCount, fAdvanceCount; |
| 235 | 236 |
| 236 struct CharGlyphRec { | 237 struct CharGlyphRec { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 292 } |
| 292 } | 293 } |
| 293 | 294 |
| 294 private: | 295 private: |
| 295 SkGlyphCache* fCache; | 296 SkGlyphCache* fCache; |
| 296 | 297 |
| 297 static bool DetachProc(const SkGlyphCache*, void*); | 298 static bool DetachProc(const SkGlyphCache*, void*); |
| 298 }; | 299 }; |
| 299 | 300 |
| 300 #endif | 301 #endif |
| OLD | NEW |