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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // reclaimed. | 45 // reclaimed. |
46 size_t fBytesAllocated; | 46 size_t fBytesAllocated; |
47 | 47 |
48 friend class SkBitmapHeap; | 48 friend class SkBitmapHeap; |
49 friend class SkBitmapHeapTester; | 49 friend class SkBitmapHeapTester; |
50 }; | 50 }; |
51 | 51 |
52 | 52 |
53 class SkBitmapHeapReader : public SkRefCnt { | 53 class SkBitmapHeapReader : public SkRefCnt { |
54 public: | 54 public: |
55 SK_DECLARE_INST_COUNT(SkBitmapHeapReader) | 55 |
56 | 56 |
57 SkBitmapHeapReader() : INHERITED() {} | 57 SkBitmapHeapReader() : INHERITED() {} |
58 virtual SkBitmap* getBitmap(int32_t slot) const = 0; | 58 virtual SkBitmap* getBitmap(int32_t slot) const = 0; |
59 virtual void releaseRef(int32_t slot) = 0; | 59 virtual void releaseRef(int32_t slot) = 0; |
60 private: | 60 private: |
61 typedef SkRefCnt INHERITED; | 61 typedef SkRefCnt INHERITED; |
62 }; | 62 }; |
63 | 63 |
64 | 64 |
65 /** | 65 /** |
66 * TODO: stores immutable bitmaps into a heap | 66 * TODO: stores immutable bitmaps into a heap |
67 */ | 67 */ |
68 class SkBitmapHeap : public SkBitmapHeapReader { | 68 class SkBitmapHeap : public SkBitmapHeapReader { |
69 public: | 69 public: |
70 class ExternalStorage : public SkRefCnt { | 70 class ExternalStorage : public SkRefCnt { |
71 public: | 71 public: |
72 SK_DECLARE_INST_COUNT(ExternalStorage) | 72 |
73 | 73 |
74 virtual bool insert(const SkBitmap& bitmap, int32_t slot) = 0; | 74 virtual bool insert(const SkBitmap& bitmap, int32_t slot) = 0; |
75 | 75 |
76 private: | 76 private: |
77 typedef SkRefCnt INHERITED; | 77 typedef SkRefCnt INHERITED; |
78 }; | 78 }; |
79 | 79 |
80 static const int32_t UNLIMITED_SIZE = -1; | 80 static const int32_t UNLIMITED_SIZE = -1; |
81 static const int32_t IGNORE_OWNERS = -1; | 81 static const int32_t IGNORE_OWNERS = -1; |
82 static const int32_t INVALID_SLOT = -1; | 82 static const int32_t INVALID_SLOT = -1; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 const int32_t fOwnerCount; | 289 const int32_t fOwnerCount; |
290 size_t fBytesAllocated; | 290 size_t fBytesAllocated; |
291 | 291 |
292 bool fDeferAddingOwners; | 292 bool fDeferAddingOwners; |
293 SkTDArray<int> fDeferredEntries; | 293 SkTDArray<int> fDeferredEntries; |
294 | 294 |
295 typedef SkBitmapHeapReader INHERITED; | 295 typedef SkBitmapHeapReader INHERITED; |
296 }; | 296 }; |
297 | 297 |
298 #endif // SkBitmapHeap_DEFINED | 298 #endif // SkBitmapHeap_DEFINED |
OLD | NEW |