OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
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 #ifndef SkWriter32_DEFINED | 10 #ifndef SkWriter32_DEFINED |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 // read from the stream, and write up to length bytes. Return the actual | 240 // read from the stream, and write up to length bytes. Return the actual |
241 // number of bytes written. | 241 // number of bytes written. |
242 size_t readFromStream(SkStream* stream, size_t length) { | 242 size_t readFromStream(SkStream* stream, size_t length) { |
243 return stream->read(this->reservePad(length), length); | 243 return stream->read(this->reservePad(length), length); |
244 } | 244 } |
245 | 245 |
246 /** | 246 /** |
247 * Captures a snapshot of the data as it is right now, and return it. | 247 * Captures a snapshot of the data as it is right now, and return it. |
248 */ | 248 */ |
249 SkData* snapshotAsData() const; | 249 sk_sp<SkData> snapshotAsData() const; |
250 private: | 250 private: |
251 void growToAtLeast(size_t size); | 251 void growToAtLeast(size_t size); |
252 | 252 |
253 uint8_t* fData; // Points to either fInternal or fExterna
l. | 253 uint8_t* fData; // Points to either fInternal or fExterna
l. |
254 size_t fCapacity; // Number of bytes we can write to fData. | 254 size_t fCapacity; // Number of bytes we can write to fData. |
255 size_t fUsed; // Number of bytes written. | 255 size_t fUsed; // Number of bytes written. |
256 void* fExternal; // Unmanaged memory block. | 256 void* fExternal; // Unmanaged memory block. |
257 SkAutoTMalloc<uint8_t> fInternal; // Managed memory block. | 257 SkAutoTMalloc<uint8_t> fInternal; // Managed memory block. |
258 }; | 258 }; |
259 | 259 |
(...skipping 13 matching lines...) Expand all Loading... |
273 union { | 273 union { |
274 void* fPtrAlignment; | 274 void* fPtrAlignment; |
275 double fDoubleAlignment; | 275 double fDoubleAlignment; |
276 char fStorage[SIZE]; | 276 char fStorage[SIZE]; |
277 } fData; | 277 } fData; |
278 | 278 |
279 typedef SkWriter32 INHERITED; | 279 typedef SkWriter32 INHERITED; |
280 }; | 280 }; |
281 | 281 |
282 #endif | 282 #endif |
OLD | NEW |