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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return cache; | 553 return cache; |
554 } | 554 } |
555 | 555 |
556 size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) { | 556 size_t SkGlyphCache_Globals::internalPurge(size_t minBytesNeeded) { |
557 this->validate(); | 557 this->validate(); |
558 | 558 |
559 size_t bytesNeeded = 0; | 559 size_t bytesNeeded = 0; |
560 if (fTotalMemoryUsed > fCacheSizeLimit) { | 560 if (fTotalMemoryUsed > fCacheSizeLimit) { |
561 bytesNeeded = fTotalMemoryUsed - fCacheSizeLimit; | 561 bytesNeeded = fTotalMemoryUsed - fCacheSizeLimit; |
562 } | 562 } |
563 bytesNeeded = SkMax32(bytesNeeded, minBytesNeeded); | 563 bytesNeeded = SkTMax(bytesNeeded, minBytesNeeded); |
564 if (bytesNeeded) { | 564 if (bytesNeeded) { |
565 // no small purges! | 565 // no small purges! |
566 bytesNeeded = SkMax32(bytesNeeded, fTotalMemoryUsed >> 2); | 566 bytesNeeded = SkTMax(bytesNeeded, fTotalMemoryUsed >> 2); |
567 } | 567 } |
568 | 568 |
569 int countNeeded = 0; | 569 int countNeeded = 0; |
570 if (fCacheCount > fCacheCountLimit) { | 570 if (fCacheCount > fCacheCountLimit) { |
571 countNeeded = fCacheCount - fCacheCountLimit; | 571 countNeeded = fCacheCount - fCacheCountLimit; |
572 // no small purges! | 572 // no small purges! |
573 countNeeded = SkMax32(countNeeded, fCacheCount >> 2); | 573 countNeeded = SkMax32(countNeeded, fCacheCount >> 2); |
574 } | 574 } |
575 | 575 |
576 // early exit | 576 // early exit |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 return tls ? tls->getCacheSizeLimit() : 0; | 709 return tls ? tls->getCacheSizeLimit() : 0; |
710 } | 710 } |
711 | 711 |
712 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { | 712 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { |
713 if (0 == bytes) { | 713 if (0 == bytes) { |
714 SkGlyphCache_Globals::DeleteTLS(); | 714 SkGlyphCache_Globals::DeleteTLS(); |
715 } else { | 715 } else { |
716 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); | 716 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); |
717 } | 717 } |
718 } | 718 } |
OLD | NEW |