OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 |
11 #ifndef SkData_DEFINED | 11 #ifndef SkData_DEFINED |
12 #define SkData_DEFINED | 12 #define SkData_DEFINED |
13 | 13 |
14 #include "SkFlattenable.h" | 14 #include "SkFlattenable.h" |
15 | 15 |
16 struct SkFILE; | 16 struct SkFILE; |
17 | 17 |
18 /** | 18 /** |
19 * SkData holds an immutable data buffer. Not only is the data immutable, | 19 * SkData holds an immutable data buffer. Not only is the data immutable, |
20 * but the actual ptr that is returned (by data() or bytes()) is guaranteed | 20 * but the actual ptr that is returned (by data() or bytes()) is guaranteed |
21 * to always be the same for the life of this instance. | 21 * to always be the same for the life of this instance. |
22 */ | 22 */ |
23 class SK_API SkData : public SkFlattenable { | 23 class SK_API SkData : public SkFlattenable { |
| 24 typedef SkFlattenable INHERITED; |
| 25 |
24 public: | 26 public: |
25 SK_DECLARE_INST_COUNT(SkData) | 27 SK_DECLARE_INST_COUNT(SkData) |
26 | 28 |
27 /** | 29 /** |
28 * Returns the number of bytes stored. | 30 * Returns the number of bytes stored. |
29 */ | 31 */ |
30 size_t size() const { return fSize; } | 32 size_t size() const { return fSize; } |
31 | 33 |
32 bool isEmpty() const { return 0 == fSize; } | 34 bool isEmpty() const { return 0 == fSize; } |
33 | 35 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 136 |
135 private: | 137 private: |
136 ReleaseProc fReleaseProc; | 138 ReleaseProc fReleaseProc; |
137 void* fReleaseProcContext; | 139 void* fReleaseProcContext; |
138 | 140 |
139 const void* fPtr; | 141 const void* fPtr; |
140 size_t fSize; | 142 size_t fSize; |
141 | 143 |
142 SkData(const void* ptr, size_t size, ReleaseProc, void* context); | 144 SkData(const void* ptr, size_t size, ReleaseProc, void* context); |
143 virtual ~SkData(); | 145 virtual ~SkData(); |
144 | |
145 typedef SkFlattenable INHERITED; | |
146 }; | 146 }; |
147 | 147 |
148 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ | 148 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ |
149 typedef SkAutoTUnref<SkData> SkAutoDataUnref; | 149 typedef SkAutoTUnref<SkData> SkAutoDataUnref; |
150 | 150 |
151 #endif | 151 #endif |
OLD | NEW |