Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: include/core/SkWriter32.h

Issue 1779263003: Make sp variants for SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkStream.h ('k') | include/effects/SkColorCubeFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « include/core/SkStream.h ('k') | include/effects/SkColorCubeFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698