| 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 #ifndef SkScaledImageCache_DEFINED | 8 #ifndef SkScaledImageCache_DEFINED |
| 9 #define SkScaledImageCache_DEFINED | 9 #define SkScaledImageCache_DEFINED |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Set the maximum number of bytes available to this cache. If the current | 121 * Set the maximum number of bytes available to this cache. If the current |
| 122 * cache exceeds this new value, it will be purged to try to fit within | 122 * cache exceeds this new value, it will be purged to try to fit within |
| 123 * this new limit. | 123 * this new limit. |
| 124 */ | 124 */ |
| 125 size_t setByteLimit(size_t newLimit); | 125 size_t setByteLimit(size_t newLimit); |
| 126 | 126 |
| 127 public: | 127 public: |
| 128 struct Rec; | 128 struct Rec; |
| 129 struct Key; |
| 129 private: | 130 private: |
| 130 Rec* fHead; | 131 Rec* fHead; |
| 131 Rec* fTail; | 132 Rec* fTail; |
| 132 | 133 |
| 133 class Hash; | 134 class Hash; |
| 134 Hash* fHash; | 135 Hash* fHash; |
| 135 | 136 |
| 136 size_t fBytesUsed; | 137 size_t fBytesUsed; |
| 137 size_t fByteLimit; | 138 size_t fByteLimit; |
| 138 int fCount; | 139 int fCount; |
| 139 | 140 |
| 140 Rec* findAndLock(uint32_t generationID, SkScalar sx, SkScalar sy, | 141 Rec* findAndLock(uint32_t generationID, SkScalar sx, SkScalar sy, |
| 141 const SkIRect& bounds); | 142 const SkIRect& bounds); |
| 142 void addAndLock(Rec* rec); | 143 Rec* findAndLock(const Key& key); |
| 144 ID* addAndLock(Rec* rec); |
| 143 | 145 |
| 144 void purgeAsNeeded(); | 146 void purgeAsNeeded(); |
| 145 | 147 |
| 146 // linklist management | 148 // linklist management |
| 147 void moveToHead(Rec*); | 149 void moveToHead(Rec*); |
| 148 void addToHead(Rec*); | 150 void addToHead(Rec*); |
| 149 void detach(Rec*); | 151 void detach(Rec*); |
| 150 #ifdef SK_DEBUG | 152 #ifdef SK_DEBUG |
| 151 void validate() const; | 153 void validate() const; |
| 152 #else | 154 #else |
| 153 void validate() const {} | 155 void validate() const {} |
| 154 #endif | 156 #endif |
| 155 }; | 157 }; |
| 156 #endif | 158 #endif |
| OLD | NEW |