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 <stdio.h> | 11 #include <stdio.h> |
12 | 12 |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 | 14 |
15 class SkStream; | 15 class SkStream; |
16 | 16 |
17 #ifndef SK_SUPPORT_LEGACY_DATA_FACTORIES | |
18 #define SK_SUPPORT_LEGACY_DATA_FACTORIES | |
19 #endif | |
20 | |
21 /** | 17 /** |
22 * SkData holds an immutable data buffer. Not only is the data immutable, | 18 * SkData holds an immutable data buffer. Not only is the data immutable, |
23 * but the actual ptr that is returned (by data() or bytes()) is guaranteed | 19 * but the actual ptr that is returned (by data() or bytes()) is guaranteed |
24 * to always be the same for the life of this instance. | 20 * to always be the same for the life of this instance. |
25 */ | 21 */ |
26 class SK_API SkData : public SkRefCnt { | 22 class SK_API SkData : public SkRefCnt { |
27 public: | 23 public: |
28 /** | 24 /** |
29 * Returns the number of bytes stored. | 25 * Returns the number of bytes stored. |
30 */ | 26 */ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 * length to the size of the data. If buffer is NULL, it is ignored, and | 60 * length to the size of the data. If buffer is NULL, it is ignored, and |
65 * only the computed number of bytes is returned. | 61 * only the computed number of bytes is returned. |
66 */ | 62 */ |
67 size_t copyRange(size_t offset, size_t length, void* buffer) const; | 63 size_t copyRange(size_t offset, size_t length, void* buffer) const; |
68 | 64 |
69 /** | 65 /** |
70 * Returns true if these two objects have the same length and contents, | 66 * Returns true if these two objects have the same length and contents, |
71 * effectively returning 0 == memcmp(...) | 67 * effectively returning 0 == memcmp(...) |
72 */ | 68 */ |
73 bool equals(const SkData* other) const; | 69 bool equals(const SkData* other) const; |
70 #ifdef SK_SUPPORT_LEGACY_DATA_FACTORIES | |
reed1
2016/08/02 21:11:25
why is this guy guarded?
bungeman-skia
2016/08/02 21:29:56
This has caused some rather awkward code in Chromi
| |
74 bool equals(sk_sp<const SkData>& other) const { return this->equals(other.ge t()); } | 71 bool equals(sk_sp<const SkData>& other) const { return this->equals(other.ge t()); } |
72 #endif | |
75 | 73 |
76 /** | 74 /** |
77 * Function that, if provided, will be called when the SkData goes out | 75 * Function that, if provided, will be called when the SkData goes out |
78 * of scope, allowing for custom allocation/freeing of the data's contents. | 76 * of scope, allowing for custom allocation/freeing of the data's contents. |
79 */ | 77 */ |
80 typedef void (*ReleaseProc)(const void* ptr, void* context); | 78 typedef void (*ReleaseProc)(const void* ptr, void* context); |
81 | 79 |
82 /** | 80 /** |
83 * Create a new dataref by copying the specified data | 81 * Create a new dataref by copying the specified data |
84 */ | 82 */ |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 | 220 |
223 typedef SkRefCnt INHERITED; | 221 typedef SkRefCnt INHERITED; |
224 }; | 222 }; |
225 | 223 |
226 #ifdef SK_SUPPORT_LEGACY_DATA_FACTORIES | 224 #ifdef SK_SUPPORT_LEGACY_DATA_FACTORIES |
227 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ | 225 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ |
228 typedef SkAutoTUnref<SkData> SkAutoDataUnref; | 226 typedef SkAutoTUnref<SkData> SkAutoDataUnref; |
229 #endif | 227 #endif |
230 | 228 |
231 #endif | 229 #endif |
OLD | NEW |