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 "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return rec.fKey == key; | 142 return rec.fKey == key; |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 class SkScaledImageCache::Hash : public SkTDynamicHash<SkScaledImageCache::Rec, | 146 class SkScaledImageCache::Hash : public SkTDynamicHash<SkScaledImageCache::Rec, |
147 Key, key_from_rec, hash_from_key, | 147 Key, key_from_rec, hash_from_key, |
148 eq_rec_key> {}; | 148 eq_rec_key> {}; |
149 | 149 |
150 /////////////////////////////////////////////////////////////////////////////// | 150 /////////////////////////////////////////////////////////////////////////////// |
151 | 151 |
152 //#define USE_HASH | 152 #define USE_HASH |
153 | 153 |
154 SkScaledImageCache::SkScaledImageCache(size_t byteLimit) { | 154 SkScaledImageCache::SkScaledImageCache(size_t byteLimit) { |
155 fHead = NULL; | 155 fHead = NULL; |
156 fTail = NULL; | 156 fTail = NULL; |
157 #ifdef USE_HASH | 157 #ifdef USE_HASH |
158 fHash = new Hash; | 158 fHash = new Hash; |
159 #else | 159 #else |
160 fHash = NULL; | 160 fHash = NULL; |
161 #endif | 161 #endif |
162 fBytesUsed = 0; | 162 fBytesUsed = 0; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 return SkScaledImageCache::GetBytesUsed(); | 518 return SkScaledImageCache::GetBytesUsed(); |
519 } | 519 } |
520 | 520 |
521 size_t SkGraphics::GetImageCacheByteLimit() { | 521 size_t SkGraphics::GetImageCacheByteLimit() { |
522 return SkScaledImageCache::GetByteLimit(); | 522 return SkScaledImageCache::GetByteLimit(); |
523 } | 523 } |
524 | 524 |
525 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 525 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { |
526 return SkScaledImageCache::SetByteLimit(newLimit); | 526 return SkScaledImageCache::SetByteLimit(newLimit); |
527 } | 527 } |
OLD | NEW |