OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 #ifndef SkBitmapHeap_DEFINED | 8 #ifndef SkBitmapHeap_DEFINED |
9 #define SkBitmapHeap_DEFINED | 9 #define SkBitmapHeap_DEFINED |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 const uint32_t fWidth; | 231 const uint32_t fWidth; |
232 const uint32_t fHeight; | 232 const uint32_t fHeight; |
233 | 233 |
234 // TODO: Generalize the LRU caching mechanism | 234 // TODO: Generalize the LRU caching mechanism |
235 LookupEntry* fMoreRecentlyUsed; | 235 LookupEntry* fMoreRecentlyUsed; |
236 LookupEntry* fLessRecentlyUsed; | 236 LookupEntry* fLessRecentlyUsed; |
237 | 237 |
238 uint32_t fStorageSlot; // slot of corresponding bitmap in fStorage. | 238 uint32_t fStorageSlot; // slot of corresponding bitmap in fStorage. |
239 | 239 |
240 /** | 240 /** |
241 * Compare two LookupEntry pointers, returning -1, 0, 1 for sorting. | 241 * Compare two LookupEntry pointers for sorting and searching. |
242 */ | 242 */ |
243 static int Compare(const LookupEntry* a, const LookupEntry* b); | 243 static bool Less(const LookupEntry& a, const LookupEntry& b); |
244 }; | 244 }; |
245 | 245 |
246 /** | 246 /** |
247 * Remove the entry from the lookup table. Also deletes the entry pointed | 247 * Remove the entry from the lookup table. Also deletes the entry pointed |
248 * to by the table. Therefore, if a pointer to that one was passed in, the | 248 * to by the table. Therefore, if a pointer to that one was passed in, the |
249 * pointer should no longer be used, since the object to which it points has | 249 * pointer should no longer be used, since the object to which it points has |
250 * been deleted. | 250 * been deleted. |
251 * @return The index in the lookup table of the entry before removal. | 251 * @return The index in the lookup table of the entry before removal. |
252 */ | 252 */ |
253 int removeEntryFromLookupTable(LookupEntry*); | 253 int removeEntryFromLookupTable(LookupEntry*); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 const int32_t fOwnerCount; | 298 const int32_t fOwnerCount; |
299 size_t fBytesAllocated; | 299 size_t fBytesAllocated; |
300 | 300 |
301 bool fDeferAddingOwners; | 301 bool fDeferAddingOwners; |
302 SkTDArray<int> fDeferredEntries; | 302 SkTDArray<int> fDeferredEntries; |
303 | 303 |
304 typedef SkBitmapHeapReader INHERITED; | 304 typedef SkBitmapHeapReader INHERITED; |
305 }; | 305 }; |
306 | 306 |
307 #endif // SkBitmapHeap_DEFINED | 307 #endif // SkBitmapHeap_DEFINED |
OLD | NEW |