| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 * Resume adding references when duplicate SkBitmaps are inserted. | 213 * Resume adding references when duplicate SkBitmaps are inserted. |
| 214 * @param add If true, add references to the SkBitmapHeapEntrys whose SkBitm
aps were re-inserted | 214 * @param add If true, add references to the SkBitmapHeapEntrys whose SkBitm
aps were re-inserted |
| 215 * while deferring. | 215 * while deferring. |
| 216 */ | 216 */ |
| 217 void endAddingOwnersDeferral(bool add); | 217 void endAddingOwnersDeferral(bool add); |
| 218 | 218 |
| 219 private: | 219 private: |
| 220 struct LookupEntry { | 220 struct LookupEntry { |
| 221 LookupEntry(const SkBitmap& bm) | 221 LookupEntry(const SkBitmap& bm) |
| 222 : fGenerationId(bm.getGenerationID()) | 222 : fGenerationId(bm.getGenerationID()) |
| 223 , fPixelOffset(bm.pixelRefOffset()) | 223 , fPixelOrigin(bm.pixelRefOrigin()) |
| 224 , fWidth(bm.width()) | 224 , fWidth(bm.width()) |
| 225 , fHeight(bm.height()) | 225 , fHeight(bm.height()) |
| 226 , fMoreRecentlyUsed(NULL) | 226 , fMoreRecentlyUsed(NULL) |
| 227 , fLessRecentlyUsed(NULL){} | 227 , fLessRecentlyUsed(NULL){} |
| 228 | 228 |
| 229 const uint32_t fGenerationId; // SkPixelRef GenerationID. | 229 const uint32_t fGenerationId; // SkPixelRef GenerationID. |
| 230 const size_t fPixelOffset; | 230 const SkIPoint fPixelOrigin; |
| 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 /** |
| (...skipping 57 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 |