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

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

Issue 568683002: use SkData::NewUninitialized (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add SkStream::readIntoData Created 6 years, 3 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 | « no previous file | src/core/SkPictureData.cpp » ('j') | tools/lua/lua_pictures.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkStream_DEFINED 8 #ifndef SkStream_DEFINED
9 #define SkStream_DEFINED 9 #define SkStream_DEFINED
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 /** Reads or skips size number of bytes. 50 /** Reads or skips size number of bytes.
51 * If buffer == NULL, skip size bytes, return how many were skipped. 51 * If buffer == NULL, skip size bytes, return how many were skipped.
52 * If buffer != NULL, copy size bytes into buffer, return how many were cop ied. 52 * If buffer != NULL, copy size bytes into buffer, return how many were cop ied.
53 * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer 53 * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer
54 * @param size the number of bytes to skip or copy 54 * @param size the number of bytes to skip or copy
55 * @return the number of bytes actually read. 55 * @return the number of bytes actually read.
56 */ 56 */
57 virtual size_t read(void* buffer, size_t size) = 0; 57 virtual size_t read(void* buffer, size_t size) = 0;
58 58
59 /**
60 * Attempt to read size bytes into a SkData. If the read success, return th e data,
61 * else return NULL. Either way the stream's cursor may have been changed a s a result
62 * of calling read().
63 */
64 SkData* readIntoData(size_t size);
bungeman-skia 2014/09/12 14:50:27 Eck, not another thing on SkStream... It seems li
reed1 2014/09/12 18:55:17 Done.
65
59 /** Skip size number of bytes. 66 /** Skip size number of bytes.
60 * @return the actual number bytes that could be skipped. 67 * @return the actual number bytes that could be skipped.
61 */ 68 */
62 size_t skip(size_t size) { 69 size_t skip(size_t size) {
63 return this->read(NULL, size); 70 return this->read(NULL, size);
64 } 71 }
65 72
66 /** Returns true when all the bytes in the stream have been read. 73 /** Returns true when all the bytes in the stream have been read.
67 * This may return true early (when there are no more bytes to be read) 74 * This may return true early (when there are no more bytes to be read)
68 * or late (after the first unsuccessful read). 75 * or late (after the first unsuccessful read).
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 463
457 private: 464 private:
458 size_t fBytesWritten; 465 size_t fBytesWritten;
459 typedef SkWStream INHERITED; 466 typedef SkWStream INHERITED;
460 }; 467 };
461 468
462 // for now 469 // for now
463 typedef SkFILEStream SkURLStream; 470 typedef SkFILEStream SkURLStream;
464 471
465 #endif 472 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureData.cpp » ('j') | tools/lua/lua_pictures.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698