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 #include "SkGlyphCache.h" | 10 #include "SkGlyphCache.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) | 56 SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) |
57 : fGlyphAlloc(kMinGlphAlloc) | 57 : fGlyphAlloc(kMinGlphAlloc) |
58 , fImageAlloc(kMinImageAlloc) { | 58 , fImageAlloc(kMinImageAlloc) { |
59 SkASSERT(typeface); | 59 SkASSERT(typeface); |
60 | 60 |
61 fPrev = fNext = NULL; | 61 fPrev = fNext = NULL; |
62 | 62 |
63 fDesc = desc->copy(); | 63 fDesc = desc->copy(); |
64 fScalerContext = typeface->createScalerContext(desc); | 64 fScalerContext = typeface->createScalerContext(desc); |
65 fScalerContext->getFontMetrics(NULL, &fFontMetricsY); | 65 fScalerContext->getFontMetrics(&fFontMetrics); |
66 | 66 |
67 // init to 0 so that all of the pointers will be null | 67 // init to 0 so that all of the pointers will be null |
68 memset(fGlyphHash, 0, sizeof(fGlyphHash)); | 68 memset(fGlyphHash, 0, sizeof(fGlyphHash)); |
69 // init with 0xFF so that the charCode field will be -1, which is invalid | 69 // init with 0xFF so that the charCode field will be -1, which is invalid |
70 memset(fCharToGlyphHash, 0xFF, sizeof(fCharToGlyphHash)); | 70 memset(fCharToGlyphHash, 0xFF, sizeof(fCharToGlyphHash)); |
71 | 71 |
72 fMemoryUsed = sizeof(*this) + kMinGlphAlloc + kMinImageAlloc; | 72 fMemoryUsed = sizeof(*this) + kMinGlphAlloc + kMinImageAlloc; |
73 | 73 |
74 fGlyphArray.setReserve(METRICS_RESERVE_COUNT); | 74 fGlyphArray.setReserve(METRICS_RESERVE_COUNT); |
75 | 75 |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 return tls ? tls->getFontCacheLimit() : 0; | 742 return tls ? tls->getFontCacheLimit() : 0; |
743 } | 743 } |
744 | 744 |
745 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { | 745 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { |
746 if (0 == bytes) { | 746 if (0 == bytes) { |
747 SkGlyphCache_Globals::DeleteTLS(); | 747 SkGlyphCache_Globals::DeleteTLS(); |
748 } else { | 748 } else { |
749 SkGlyphCache_Globals::GetTLS().setFontCacheLimit(bytes); | 749 SkGlyphCache_Globals::GetTLS().setFontCacheLimit(bytes); |
750 } | 750 } |
751 } | 751 } |
OLD | NEW |