| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkGlyphCache.h" | 8 #include "SkGlyphCache.h" |
| 9 #include "SkGlyphCache_Globals.h" | 9 #include "SkGlyphCache_Globals.h" |
| 10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface, | 513 SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface, |
| 514 const SkScalerContextEffects& effects, | 514 const SkScalerContextEffects& effects, |
| 515 const SkDescriptor* desc, | 515 const SkDescriptor* desc, |
| 516 bool (*proc)(const SkGlyphCache*, void*), | 516 bool (*proc)(const SkGlyphCache*, void*), |
| 517 void* context) { | 517 void* context) { |
| 518 if (!typeface) { | 518 if (!typeface) { |
| 519 typeface = SkTypeface::GetDefaultTypeface(); | 519 typeface = SkTypeface::GetDefaultTypeface(); |
| 520 } | 520 } |
| 521 SkASSERT(desc); | 521 SkASSERT(desc); |
| 522 | 522 |
| 523 // Precondition: the typeface id must be the fFontID in the descriptor |
| 524 SkDEBUGCODE( |
| 525 uint32_t length; |
| 526 const SkScalerContext::Rec* rec = static_cast<const SkScalerContext::Rec
*>( |
| 527 desc->findEntry(kRec_SkDescriptorTag, &length)); |
| 528 SkASSERT(rec); |
| 529 SkASSERT(length == sizeof(*rec)); |
| 530 SkASSERT(typeface->uniqueID() == rec->fFontID); |
| 531 ) |
| 532 |
| 523 SkGlyphCache_Globals& globals = get_globals(); | 533 SkGlyphCache_Globals& globals = get_globals(); |
| 524 SkGlyphCache* cache; | 534 SkGlyphCache* cache; |
| 525 | 535 |
| 526 { | 536 { |
| 527 Exclusive ac(globals.fLock); | 537 Exclusive ac(globals.fLock); |
| 528 | 538 |
| 529 globals.validate(); | 539 globals.validate(); |
| 530 | 540 |
| 531 for (cache = globals.internalGetHead(); cache != nullptr; cache = cache-
>fNext) { | 541 for (cache = globals.internalGetHead(); cache != nullptr; cache = cache-
>fNext) { |
| 532 if (*cache->fDesc == *desc) { | 542 if (*cache->fDesc == *desc) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 827 } |
| 818 | 828 |
| 819 void SkGraphics::PurgeFontCache() { | 829 void SkGraphics::PurgeFontCache() { |
| 820 get_globals().purgeAll(); | 830 get_globals().purgeAll(); |
| 821 SkTypefaceCache::PurgeAll(); | 831 SkTypefaceCache::PurgeAll(); |
| 822 } | 832 } |
| 823 | 833 |
| 824 // TODO(herb): clean up TLS apis. | 834 // TODO(herb): clean up TLS apis. |
| 825 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } | 835 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } |
| 826 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } | 836 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } |
| OLD | NEW |