| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2013 Google Inc. | 2  * Copyright 2013 Google Inc. | 
| 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 "SkScaledImageCache.h" | 8 #include "SkScaledImageCache.h" | 
| 9 #include "SkMipMap.h" | 9 #include "SkMipMap.h" | 
| 10 #include "SkOnce.h" | 10 #include "SkOnce.h" | 
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 418 /** | 418 /** | 
| 419    This private method is the fully general record adder. All other | 419    This private method is the fully general record adder. All other | 
| 420    record adders should call this funtion. */ | 420    record adders should call this funtion. */ | 
| 421 SkScaledImageCache::ID* SkScaledImageCache::addAndLock(SkScaledImageCache::Rec* 
     rec) { | 421 SkScaledImageCache::ID* SkScaledImageCache::addAndLock(SkScaledImageCache::Rec* 
     rec) { | 
| 422     SkASSERT(rec); | 422     SkASSERT(rec); | 
| 423     // See if we already have this key (racy inserts, etc.) | 423     // See if we already have this key (racy inserts, etc.) | 
| 424     Rec* existing = this->findAndLock(rec->fKey); | 424     Rec* existing = this->findAndLock(rec->fKey); | 
| 425     if (NULL != existing) { | 425     if (NULL != existing) { | 
| 426         // Since we already have a matching entry, just delete the new one and r
     eturn. | 426         // Since we already have a matching entry, just delete the new one and r
     eturn. | 
| 427         // Call sites cannot assume the passed in object will live past this cal
     l. | 427         // Call sites cannot assume the passed in object will live past this cal
     l. | 
|  | 428         existing->fBitmap = rec->fBitmap; | 
| 428         SkDELETE(rec); | 429         SkDELETE(rec); | 
| 429         return rec_to_id(existing); | 430         return rec_to_id(existing); | 
| 430     } | 431     } | 
| 431 | 432 | 
| 432     this->addToHead(rec); | 433     this->addToHead(rec); | 
| 433     SkASSERT(1 == rec->fLockCount); | 434     SkASSERT(1 == rec->fLockCount); | 
| 434 #ifdef USE_HASH | 435 #ifdef USE_HASH | 
| 435     SkASSERT(fHash); | 436     SkASSERT(fHash); | 
| 436     fHash->add(rec); | 437     fHash->add(rec); | 
| 437 #endif | 438 #endif | 
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 788     return SkScaledImageCache::GetBytesUsed(); | 789     return SkScaledImageCache::GetBytesUsed(); | 
| 789 } | 790 } | 
| 790 | 791 | 
| 791 size_t SkGraphics::GetImageCacheByteLimit() { | 792 size_t SkGraphics::GetImageCacheByteLimit() { | 
| 792     return SkScaledImageCache::GetByteLimit(); | 793     return SkScaledImageCache::GetByteLimit(); | 
| 793 } | 794 } | 
| 794 | 795 | 
| 795 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 796 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 
| 796     return SkScaledImageCache::SetByteLimit(newLimit); | 797     return SkScaledImageCache::SetByteLimit(newLimit); | 
| 797 } | 798 } | 
| OLD | NEW | 
|---|