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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // experimental hash to speed things up | 152 // experimental hash to speed things up |
153 //#define USE_HASH | 153 #define USE_HASH |
154 | 154 |
155 SkScaledImageCache::SkScaledImageCache(size_t byteLimit) { | 155 SkScaledImageCache::SkScaledImageCache(size_t byteLimit) { |
156 fHead = NULL; | 156 fHead = NULL; |
157 fTail = NULL; | 157 fTail = NULL; |
158 #ifdef USE_HASH | 158 #ifdef USE_HASH |
159 fHash = new Hash; | 159 fHash = new Hash; |
160 #else | 160 #else |
161 fHash = NULL; | 161 fHash = NULL; |
162 #endif | 162 #endif |
163 fBytesUsed = 0; | 163 fBytesUsed = 0; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 return SkScaledImageCache::GetBytesUsed(); | 516 return SkScaledImageCache::GetBytesUsed(); |
517 } | 517 } |
518 | 518 |
519 size_t SkGraphics::GetImageCacheByteLimit() { | 519 size_t SkGraphics::GetImageCacheByteLimit() { |
520 return SkScaledImageCache::GetByteLimit(); | 520 return SkScaledImageCache::GetByteLimit(); |
521 } | 521 } |
522 | 522 |
523 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 523 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { |
524 return SkScaledImageCache::SetByteLimit(newLimit); | 524 return SkScaledImageCache::SetByteLimit(newLimit); |
525 } | 525 } |
OLD | NEW |