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 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 /** | 87 /** |
88 * Create a new dataref from a pointer allocated by malloc. The Data object | 88 * Create a new dataref from a pointer allocated by malloc. The Data object |
89 * takes ownership of that allocation, and will handling calling sk_free. | 89 * takes ownership of that allocation, and will handling calling sk_free. |
90 */ | 90 */ |
91 static SkData* NewFromMalloc(const void* data, size_t length); | 91 static SkData* NewFromMalloc(const void* data, size_t length); |
92 | 92 |
93 /** | 93 /** |
94 * Create a new dataref from a SkFILE. | 94 * Create a new dataref from a SkFILE. |
95 * This does not take ownership of the SkFILE, nor close it. | 95 * This does not take ownership of the SkFILE, nor close it. |
| 96 * The caller is free to close the SkFILE at its convenience. |
96 * The SkFILE must be open for reading only. | 97 * The SkFILE must be open for reading only. |
97 * Returns NULL on failure. | 98 * Returns NULL on failure. |
98 */ | 99 */ |
99 static SkData* NewFromFILE(SkFILE* f); | 100 static SkData* NewFromFILE(SkFILE* f); |
100 | 101 |
101 /** | 102 /** |
| 103 * Create a new dataref from a file descriptor. |
| 104 * This does not take ownership of the file descriptor, nor close it. |
| 105 * The caller is free to close the file descriptor at its convenience. |
| 106 * The file descriptor must be open for reading only. |
| 107 * Returns NULL on failure. |
| 108 */ |
| 109 static SkData* NewFromFD(int fd); |
| 110 |
| 111 /** |
102 * Create a new dataref using a subset of the data in the specified | 112 * Create a new dataref using a subset of the data in the specified |
103 * src dataref. | 113 * src dataref. |
104 */ | 114 */ |
105 static SkData* NewSubset(const SkData* src, size_t offset, size_t length); | 115 static SkData* NewSubset(const SkData* src, size_t offset, size_t length); |
106 | 116 |
107 /** | 117 /** |
108 * Returns a new empty dataref (or a reference to a shared empty dataref). | 118 * Returns a new empty dataref (or a reference to a shared empty dataref). |
109 * New or shared, the caller must see that unref() is eventually called. | 119 * New or shared, the caller must see that unref() is eventually called. |
110 */ | 120 */ |
111 static SkData* NewEmpty(); | 121 static SkData* NewEmpty(); |
(...skipping 14 matching lines...) Expand all Loading... |
126 SkData(const void* ptr, size_t size, ReleaseProc, void* context); | 136 SkData(const void* ptr, size_t size, ReleaseProc, void* context); |
127 virtual ~SkData(); | 137 virtual ~SkData(); |
128 | 138 |
129 typedef SkFlattenable INHERITED; | 139 typedef SkFlattenable INHERITED; |
130 }; | 140 }; |
131 | 141 |
132 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ | 142 /** Typedef of SkAutoTUnref<SkData> for automatically unref-ing a SkData. */ |
133 typedef SkAutoTUnref<SkData> SkAutoDataUnref; | 143 typedef SkAutoTUnref<SkData> SkAutoDataUnref; |
134 | 144 |
135 #endif | 145 #endif |
OLD | NEW |