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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 | 59 |
60 uint8_t readU8() { return (uint8_t)this->readS8(); } | 60 uint8_t readU8() { return (uint8_t)this->readS8(); } |
61 uint16_t readU16() { return (uint16_t)this->readS16(); } | 61 uint16_t readU16() { return (uint16_t)this->readS16(); } |
62 uint32_t readU32() { return (uint32_t)this->readS32(); } | 62 uint32_t readU32() { return (uint32_t)this->readS32(); } |
63 | 63 |
64 bool readBool() { return this->readU8() != 0; } | 64 bool readBool() { return this->readU8() != 0; } |
65 SkScalar readScalar(); | 65 SkScalar readScalar(); |
66 size_t readPackedUInt(); | 66 size_t readPackedUInt(); |
67 | 67 |
68 /** | 68 /** |
69 * Create a new SkData from the stream contents. This balances the call | 69 * Reconstitute an SkData object that was written to the stream |
70 * SkWStream::writeData(). | 70 * using SkWStream::writeData(). |
71 */ | 71 */ |
72 SkData* readData(); | 72 SkData* readData(); |
73 | 73 |
74 private: | 74 private: |
75 typedef SkRefCnt INHERITED; | 75 typedef SkRefCnt INHERITED; |
76 }; | 76 }; |
77 | 77 |
78 class SK_API SkWStream : SkNoncopyable { | 78 class SK_API SkWStream : SkNoncopyable { |
79 public: | 79 public: |
80 SK_DECLARE_INST_COUNT_ROOT(SkWStream) | 80 SK_DECLARE_INST_COUNT_ROOT(SkWStream) |
(...skipping 20 matching lines...) Expand all Loading... | |
101 bool writeBigDecAsText(int64_t, int minDigits = 0); | 101 bool writeBigDecAsText(int64_t, int minDigits = 0); |
102 bool writeHexAsText(uint32_t, int minDigits = 0); | 102 bool writeHexAsText(uint32_t, int minDigits = 0); |
103 bool writeScalarAsText(SkScalar); | 103 bool writeScalarAsText(SkScalar); |
104 | 104 |
105 bool writeBool(bool v) { return this->write8(v); } | 105 bool writeBool(bool v) { return this->write8(v); } |
106 bool writeScalar(SkScalar); | 106 bool writeScalar(SkScalar); |
107 bool writePackedUInt(size_t); | 107 bool writePackedUInt(size_t); |
108 | 108 |
109 bool writeStream(SkStream* input, size_t length); | 109 bool writeStream(SkStream* input, size_t length); |
110 | 110 |
111 /** | |
112 * Append a representation of an SkData object to the stream. | |
reed1
2013/03/18 14:12:58
Not sure what the reader is to infer from "represe
epoger
2013/03/18 22:25:51
While an air of mystery can be fun, let's try to m
| |
113 * Note that this representation may include data other than the | |
114 * raw content of the SkData object. | |
115 * The SkData object can be reconstituted using SkStream::readData(). | |
116 */ | |
111 bool writeData(const SkData*); | 117 bool writeData(const SkData*); |
112 }; | 118 }; |
113 | 119 |
114 //////////////////////////////////////////////////////////////////////////////// //////// | 120 //////////////////////////////////////////////////////////////////////////////// //////// |
115 | 121 |
116 #include "SkString.h" | 122 #include "SkString.h" |
117 | 123 |
118 struct SkFILE; | 124 struct SkFILE; |
119 | 125 |
120 /** A stream that reads from a FILE*, which is opened in the constructor and | 126 /** 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... | |
373 virtual void newline() SK_OVERRIDE; | 379 virtual void newline() SK_OVERRIDE; |
374 | 380 |
375 private: | 381 private: |
376 typedef SkWStream INHERITED; | 382 typedef SkWStream INHERITED; |
377 }; | 383 }; |
378 | 384 |
379 // for now | 385 // for now |
380 typedef SkFILEStream SkURLStream; | 386 typedef SkFILEStream SkURLStream; |
381 | 387 |
382 #endif | 388 #endif |
OLD | NEW |