| OLD | NEW | 
|---|
| 1 | 1 | 
| 2 /* | 2 /* | 
| 3  * Copyright 2010 Google Inc. | 3  * Copyright 2010 Google Inc. | 
| 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 "SkGradientBitmapCache.h" | 10 #include "SkGradientBitmapCache.h" | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 101 | 101 | 
| 102 void SkGradientBitmapCache::add(const void* buffer, size_t len, const SkBitmap& 
     bm) { | 102 void SkGradientBitmapCache::add(const void* buffer, size_t len, const SkBitmap& 
     bm) { | 
| 103     AutoValidate av(this); | 103     AutoValidate av(this); | 
| 104 | 104 | 
| 105     if (fEntryCount == fMaxEntries) { | 105     if (fEntryCount == fMaxEntries) { | 
| 106         SkASSERT(fTail); | 106         SkASSERT(fTail); | 
| 107         delete this->detach(fTail); | 107         delete this->detach(fTail); | 
| 108         fEntryCount -= 1; | 108         fEntryCount -= 1; | 
| 109     } | 109     } | 
| 110 | 110 | 
| 111     Entry* entry = SkNEW_ARGS(Entry, (buffer, len, bm)); | 111     Entry* entry = new Entry(buffer, len, bm); | 
| 112     this->attachToHead(entry); | 112     this->attachToHead(entry); | 
| 113     fEntryCount += 1; | 113     fEntryCount += 1; | 
| 114 } | 114 } | 
| 115 | 115 | 
| 116 /////////////////////////////////////////////////////////////////////////////// | 116 /////////////////////////////////////////////////////////////////////////////// | 
| 117 | 117 | 
| 118 #ifdef SK_DEBUG | 118 #ifdef SK_DEBUG | 
| 119 | 119 | 
| 120 void SkGradientBitmapCache::validate() const { | 120 void SkGradientBitmapCache::validate() const { | 
| 121     SkASSERT(fEntryCount >= 0 && fEntryCount <= fMaxEntries); | 121     SkASSERT(fEntryCount >= 0 && fEntryCount <= fMaxEntries); | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 144             entry = entry->fPrev; | 144             entry = entry->fPrev; | 
| 145         } | 145         } | 
| 146         SkASSERT(0 == count); | 146         SkASSERT(0 == count); | 
| 147     } else { | 147     } else { | 
| 148         SkASSERT(NULL == fHead); | 148         SkASSERT(NULL == fHead); | 
| 149         SkASSERT(NULL == fTail); | 149         SkASSERT(NULL == fTail); | 
| 150     } | 150     } | 
| 151 } | 151 } | 
| 152 | 152 | 
| 153 #endif | 153 #endif | 
| OLD | NEW | 
|---|