Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: src/core/SkScaledImageCache.cpp

Issue 222343002: SkTDynamicHash: remove need for Equals(const T&, const Key&) param. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/core/SkTDynamicHash.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 namespace { // can't use static functions w/ template parameters 138 namespace { // can't use static functions w/ template parameters
139 const SkScaledImageCache::Key& key_from_rec(const SkScaledImageCache::Rec& rec) { 139 const SkScaledImageCache::Key& key_from_rec(const SkScaledImageCache::Rec& rec) {
140 return rec.fKey; 140 return rec.fKey;
141 } 141 }
142 142
143 uint32_t hash_from_key(const SkScaledImageCache::Key& key) { 143 uint32_t hash_from_key(const SkScaledImageCache::Key& key) {
144 return key.fHash; 144 return key.fHash;
145 } 145 }
146 146
147 bool eq_rec_key(const SkScaledImageCache::Rec& rec, const SkScaledImageCache::Ke y& key) { 147 } // namespace
148 return rec.fKey == key;
149 }
150 }
151 148
152 class SkScaledImageCache::Hash : public SkTDynamicHash<SkScaledImageCache::Rec, 149 class SkScaledImageCache::Hash : public SkTDynamicHash<SkScaledImageCache::Rec,
153 SkScaledImageCache::Key, 150 SkScaledImageCache::Key,
154 key_from_rec, 151 key_from_rec,
155 hash_from_key, 152 hash_from_key> {};
156 eq_rec_key> {}; 153
157 154
158 /////////////////////////////////////////////////////////////////////////////// 155 ///////////////////////////////////////////////////////////////////////////////
159 156
160 // experimental hash to speed things up 157 // experimental hash to speed things up
161 #define USE_HASH 158 #define USE_HASH
162 159
163 #if !defined(USE_HASH) 160 #if !defined(USE_HASH)
164 static inline SkScaledImageCache::Rec* find_rec_in_list( 161 static inline SkScaledImageCache::Rec* find_rec_in_list(
165 SkScaledImageCache::Rec* head, const Key & key) { 162 SkScaledImageCache::Rec* head, const Key & key) {
166 SkScaledImageCache::Rec* rec = head; 163 SkScaledImageCache::Rec* rec = head;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 return SkScaledImageCache::GetBytesUsed(); 786 return SkScaledImageCache::GetBytesUsed();
790 } 787 }
791 788
792 size_t SkGraphics::GetImageCacheByteLimit() { 789 size_t SkGraphics::GetImageCacheByteLimit() {
793 return SkScaledImageCache::GetByteLimit(); 790 return SkScaledImageCache::GetByteLimit();
794 } 791 }
795 792
796 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { 793 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) {
797 return SkScaledImageCache::SetByteLimit(newLimit); 794 return SkScaledImageCache::SetByteLimit(newLimit);
798 } 795 }
OLDNEW
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/core/SkTDynamicHash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698