OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkData_DEFINED | 8 #ifndef SkData_DEFINED |
9 #define SkData_DEFINED | 9 #define SkData_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 | 12 |
13 struct SkFILE; | 13 struct SkFILE; |
14 class SkStream; | 14 class SkStream; |
15 | 15 |
16 /** | 16 /** |
17 * SkData holds an immutable data buffer. Not only is the data immutable, | 17 * SkData holds an immutable data buffer. Not only is the data immutable, |
18 * but the actual ptr that is returned (by data() or bytes()) is guaranteed | 18 * but the actual ptr that is returned (by data() or bytes()) is guaranteed |
19 * to always be the same for the life of this instance. | 19 * to always be the same for the life of this instance. |
20 */ | 20 */ |
21 class SK_API SkData : public SkRefCnt { | 21 class SK_API SkData : public SkRefCnt { |
22 public: | 22 public: |
23 SK_DECLARE_INST_COUNT(SkData) | |
24 | |
25 /** | 23 /** |
26 * Returns the number of bytes stored. | 24 * Returns the number of bytes stored. |
27 */ | 25 */ |
28 size_t size() const { return fSize; } | 26 size_t size() const { return fSize; } |
29 | 27 |
30 bool isEmpty() const { return 0 == fSize; } | 28 bool isEmpty() const { return 0 == fSize; } |
31 | 29 |
32 /** | 30 /** |
33 * Returns the ptr to the data. | 31 * Returns the ptr to the data. |
34 */ | 32 */ |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 182 |
185 static void DummyReleaseProc(const void*, void*) {} | 183 static void DummyReleaseProc(const void*, void*) {} |
186 | 184 |
187 typedef SkRefCnt INHERITED; | 185 typedef SkRefCnt INHERITED; |
188 }; | 186 }; |
189 | 187 |
190 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ | 188 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ |
191 typedef SkAutoTUnref<SkData> SkAutoDataUnref; | 189 typedef SkAutoTUnref<SkData> SkAutoDataUnref; |
192 | 190 |
193 #endif | 191 #endif |
OLD | NEW |