| OLD | NEW |
| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 int32_t readS32(); | 74 int32_t readS32(); |
| 75 | 75 |
| 76 uint8_t readU8() { return (uint8_t)this->readS8(); } | 76 uint8_t readU8() { return (uint8_t)this->readS8(); } |
| 77 uint16_t readU16() { return (uint16_t)this->readS16(); } | 77 uint16_t readU16() { return (uint16_t)this->readS16(); } |
| 78 uint32_t readU32() { return (uint32_t)this->readS32(); } | 78 uint32_t readU32() { return (uint32_t)this->readS32(); } |
| 79 | 79 |
| 80 bool readBool() { return this->readU8() != 0; } | 80 bool readBool() { return this->readU8() != 0; } |
| 81 SkScalar readScalar(); | 81 SkScalar readScalar(); |
| 82 size_t readPackedUInt(); | 82 size_t readPackedUInt(); |
| 83 | 83 |
| 84 /** | |
| 85 * Reconstitute an SkData object that was written to the stream | |
| 86 * using SkWStream::writeData(). | |
| 87 */ | |
| 88 SkData* readData(); | |
| 89 | |
| 90 //SkStreamRewindable | 84 //SkStreamRewindable |
| 91 /** Rewinds to the beginning of the stream. Returns true if the stream is kn
own | 85 /** Rewinds to the beginning of the stream. Returns true if the stream is kn
own |
| 92 * to be at the beginning after this call returns. | 86 * to be at the beginning after this call returns. |
| 93 */ | 87 */ |
| 94 virtual bool rewind() { return false; } | 88 virtual bool rewind() { return false; } |
| 95 | 89 |
| 96 /** Duplicates this stream. If this cannot be done, returns NULL. | 90 /** Duplicates this stream. If this cannot be done, returns NULL. |
| 97 * The returned stream will be positioned at the beginning of its data. | 91 * The returned stream will be positioned at the beginning of its data. |
| 98 */ | 92 */ |
| 99 virtual SkStreamRewindable* duplicate() const { return NULL; } | 93 virtual SkStreamRewindable* duplicate() const { return NULL; } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 bool writeHexAsText(uint32_t, int minDigits = 0); | 197 bool writeHexAsText(uint32_t, int minDigits = 0); |
| 204 bool writeScalarAsText(SkScalar); | 198 bool writeScalarAsText(SkScalar); |
| 205 | 199 |
| 206 bool writeBool(bool v) { return this->write8(v); } | 200 bool writeBool(bool v) { return this->write8(v); } |
| 207 bool writeScalar(SkScalar); | 201 bool writeScalar(SkScalar); |
| 208 bool writePackedUInt(size_t); | 202 bool writePackedUInt(size_t); |
| 209 | 203 |
| 210 bool writeStream(SkStream* input, size_t length); | 204 bool writeStream(SkStream* input, size_t length); |
| 211 | 205 |
| 212 /** | 206 /** |
| 213 * Append an SkData object to the stream, such that it can be read | |
| 214 * out of the stream using SkStream::readData(). | |
| 215 * | |
| 216 * Note that the encoding method used to write the SkData object | |
| 217 * to the stream may change over time. This method DOES NOT | |
| 218 * just write the raw content of the SkData object to the stream. | |
| 219 */ | |
| 220 bool writeData(const SkData*); | |
| 221 | |
| 222 /** | |
| 223 * This returns the number of bytes in the stream required to store | 207 * This returns the number of bytes in the stream required to store |
| 224 * 'value'. | 208 * 'value'. |
| 225 */ | 209 */ |
| 226 static int SizeOfPackedUInt(size_t value); | 210 static int SizeOfPackedUInt(size_t value); |
| 227 }; | 211 }; |
| 228 | 212 |
| 229 ////////////////////////////////////////////////////////////////////////////////
//////// | 213 ////////////////////////////////////////////////////////////////////////////////
//////// |
| 230 | 214 |
| 231 #include "SkString.h" | 215 #include "SkString.h" |
| 232 #include <stdio.h> | 216 #include <stdio.h> |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 440 |
| 457 private: | 441 private: |
| 458 size_t fBytesWritten; | 442 size_t fBytesWritten; |
| 459 typedef SkWStream INHERITED; | 443 typedef SkWStream INHERITED; |
| 460 }; | 444 }; |
| 461 | 445 |
| 462 // for now | 446 // for now |
| 463 typedef SkFILEStream SkURLStream; | 447 typedef SkFILEStream SkURLStream; |
| 464 | 448 |
| 465 #endif | 449 #endif |
| OLD | NEW |