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

Side by Side Diff: src/gpu/GrTHashCache.h

Issue 12315131: Make SkTDArray accessors const-friendly (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « src/core/SkPictureFlat.h ('k') | src/images/SkImageDecoder_libbmp.cpp » ('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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 */ 53 */
54 int slowFindIndex(T* elem) const { return fSorted.find(elem); } 54 int slowFindIndex(T* elem) const { return fSorted.find(elem); }
55 55
56 #if GR_DEBUG 56 #if GR_DEBUG
57 void validate() const; 57 void validate() const;
58 bool contains(T*) const; 58 bool contains(T*) const;
59 #endif 59 #endif
60 60
61 // testing 61 // testing
62 const SkTDArray<T*>& getArray() const { return fSorted; } 62 const SkTDArray<T*>& getArray() const { return fSorted; }
63 SkTDArray<T*>& getArray() { return fSorted; }
63 private: 64 private:
64 enum { 65 enum {
65 kHashCount = 1 << kHashBits, 66 kHashCount = 1 << kHashBits,
66 kHashMask = kHashCount - 1 67 kHashMask = kHashCount - 1
67 }; 68 };
68 static unsigned hash2Index(uint32_t hash) { 69 static unsigned hash2Index(uint32_t hash) {
69 hash ^= hash >> 16; 70 hash ^= hash >> 16;
70 if (kHashBits <= 8) { 71 if (kHashBits <= 8) {
71 hash ^= hash >> 8; 72 hash ^= hash >> 8;
72 } 73 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 237
237 template <typename T, typename Key, size_t kHashBits> 238 template <typename T, typename Key, size_t kHashBits>
238 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const { 239 bool GrTHashTable<T, Key, kHashBits>::contains(T* elem) const {
239 int index = fSorted.find(elem); 240 int index = fSorted.find(elem);
240 return index >= 0; 241 return index >= 0;
241 } 242 }
242 243
243 #endif 244 #endif
244 245
245 #endif 246 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/images/SkImageDecoder_libbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698