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

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

Issue 989683002: Fix bit rot in SkGlyphCache validate code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 655 }
656 656
657 /////////////////////////////////////////////////////////////////////////////// 657 ///////////////////////////////////////////////////////////////////////////////
658 658
659 #ifdef SK_DEBUG 659 #ifdef SK_DEBUG
660 660
661 void SkGlyphCache::validate() const { 661 void SkGlyphCache::validate() const {
662 #ifdef SK_DEBUG_GLYPH_CACHE 662 #ifdef SK_DEBUG_GLYPH_CACHE
663 int count = fGlyphArray.count(); 663 int count = fGlyphArray.count();
664 for (int i = 0; i < count; i++) { 664 for (int i = 0; i < count; i++) {
665 const SkGlyph* glyph = fGlyphArray[i]; 665 const SkGlyph* glyph = &fGlyphArray[i];
mtklein 2015/03/06 22:25:28 Might want to const SkGlyph& glyph and use '.' bel
666 SkASSERT(glyph); 666 SkASSERT(glyph);
667 SkASSERT(fGlyphAlloc.contains(glyph));
668 if (glyph->fImage) { 667 if (glyph->fImage) {
669 SkASSERT(fGlyphAlloc.contains(glyph->fImage)); 668 SkASSERT(fGlyphAlloc.contains(glyph->fImage));
670 } 669 }
671 if (glyph->fDistanceField) {
672 SkASSERT(fGlyphAlloc.contains(glyph->fDistanceField));
673 }
674 } 670 }
675 #endif 671 #endif
676 } 672 }
677 673
678 void SkGlyphCache_Globals::validate() const { 674 void SkGlyphCache_Globals::validate() const {
679 size_t computedBytes = 0; 675 size_t computedBytes = 0;
680 int computedCount = 0; 676 int computedCount = 0;
681 677
682 const SkGlyphCache* head = fHead; 678 const SkGlyphCache* head = fHead;
683 while (head != NULL) { 679 while (head != NULL) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 return tls ? tls->getCacheSizeLimit() : 0; 727 return tls ? tls->getCacheSizeLimit() : 0;
732 } 728 }
733 729
734 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { 730 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) {
735 if (0 == bytes) { 731 if (0 == bytes) {
736 SkGlyphCache_Globals::DeleteTLS(); 732 SkGlyphCache_Globals::DeleteTLS();
737 } else { 733 } else {
738 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); 734 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes);
739 } 735 }
740 } 736 }
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