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

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

Issue 20344002: use dynamic hash to speed up scaledimagecache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « samplecode/SampleMipMap.cpp ('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 "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « samplecode/SampleMipMap.cpp ('k') | src/core/SkTDynamicHash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698