Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: src/core/SkGlyphCache.cpp

Issue 1992053002: Assert complex precondition in SkGlyphCache::Visit. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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) { }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698