OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 SkStream_DEFINED | 10 #ifndef SkStream_DEFINED |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 uint8_t readU8() { return (uint8_t)this->readS8(); } | 67 uint8_t readU8() { return (uint8_t)this->readS8(); } |
68 uint16_t readU16() { return (uint16_t)this->readS16(); } | 68 uint16_t readU16() { return (uint16_t)this->readS16(); } |
69 uint32_t readU32() { return (uint32_t)this->readS32(); } | 69 uint32_t readU32() { return (uint32_t)this->readS32(); } |
70 | 70 |
71 bool readBool() { return this->readU8() != 0; } | 71 bool readBool() { return this->readU8() != 0; } |
72 SkScalar readScalar(); | 72 SkScalar readScalar(); |
73 size_t readPackedUInt(); | 73 size_t readPackedUInt(); |
74 | 74 |
75 /** | 75 /** |
76 * Create a new SkData from the stream contents. This balances the call | 76 * Reconstitute an SkData object that was written to the stream |
77 * SkWStream::writeData(). | 77 * using SkWStream::writeData(). |
78 */ | 78 */ |
79 SkData* readData(); | 79 SkData* readData(); |
80 | 80 |
81 private: | 81 private: |
82 typedef SkRefCnt INHERITED; | 82 typedef SkRefCnt INHERITED; |
83 }; | 83 }; |
84 | 84 |
85 class SK_API SkWStream : SkNoncopyable { | 85 class SK_API SkWStream : SkNoncopyable { |
86 public: | 86 public: |
87 SK_DECLARE_INST_COUNT_ROOT(SkWStream) | 87 SK_DECLARE_INST_COUNT_ROOT(SkWStream) |
(...skipping 20 matching lines...) Expand all Loading... |
108 bool writeBigDecAsText(int64_t, int minDigits = 0); | 108 bool writeBigDecAsText(int64_t, int minDigits = 0); |
109 bool writeHexAsText(uint32_t, int minDigits = 0); | 109 bool writeHexAsText(uint32_t, int minDigits = 0); |
110 bool writeScalarAsText(SkScalar); | 110 bool writeScalarAsText(SkScalar); |
111 | 111 |
112 bool writeBool(bool v) { return this->write8(v); } | 112 bool writeBool(bool v) { return this->write8(v); } |
113 bool writeScalar(SkScalar); | 113 bool writeScalar(SkScalar); |
114 bool writePackedUInt(size_t); | 114 bool writePackedUInt(size_t); |
115 | 115 |
116 bool writeStream(SkStream* input, size_t length); | 116 bool writeStream(SkStream* input, size_t length); |
117 | 117 |
| 118 /** |
| 119 * Append an SkData object to the stream, such that it can be read |
| 120 * out of the stream using SkStream::readData(). |
| 121 * |
| 122 * Note that the encoding method used to write the SkData object |
| 123 * to the stream may change over time. This method DOES NOT |
| 124 * just write the raw content of the SkData object to the stream. |
| 125 */ |
118 bool writeData(const SkData*); | 126 bool writeData(const SkData*); |
119 }; | 127 }; |
120 | 128 |
121 ////////////////////////////////////////////////////////////////////////////////
//////// | 129 ////////////////////////////////////////////////////////////////////////////////
//////// |
122 | 130 |
123 #include "SkString.h" | 131 #include "SkString.h" |
124 | 132 |
125 struct SkFILE; | 133 struct SkFILE; |
126 | 134 |
127 /** A stream that reads from a FILE*, which is opened in the constructor and | 135 /** A stream that reads from a FILE*, which is opened in the constructor and |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 virtual void newline() SK_OVERRIDE; | 388 virtual void newline() SK_OVERRIDE; |
381 | 389 |
382 private: | 390 private: |
383 typedef SkWStream INHERITED; | 391 typedef SkWStream INHERITED; |
384 }; | 392 }; |
385 | 393 |
386 // for now | 394 // for now |
387 typedef SkFILEStream SkURLStream; | 395 typedef SkFILEStream SkURLStream; |
388 | 396 |
389 #endif | 397 #endif |
OLD | NEW |