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 SkBuffer_DEFINED | 10 #ifndef SkBuffer_DEFINED |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 /** Initialize RBuffer with a data point and length. | 33 /** Initialize RBuffer with a data point and length. |
34 */ | 34 */ |
35 SkRBuffer(const void* data, size_t size) { | 35 SkRBuffer(const void* data, size_t size) { |
36 SkASSERT(data != 0 || size == 0); | 36 SkASSERT(data != 0 || size == 0); |
37 fData = (const char*)data; | 37 fData = (const char*)data; |
38 fPos = (const char*)data; | 38 fPos = (const char*)data; |
39 fStop = (const char*)data + size; | 39 fStop = (const char*)data + size; |
40 } | 40 } |
41 | 41 |
| 42 virtual ~SkRBuffer() { } |
| 43 |
42 /** Return the number of bytes that have been read from the beginning | 44 /** Return the number of bytes that have been read from the beginning |
43 of the data pointer. | 45 of the data pointer. |
44 */ | 46 */ |
45 size_t pos() const { return fPos - fData; } | 47 size_t pos() const { return fPos - fData; } |
46 /** Return the total size of the data pointer. Only defined if the length wa
s | 48 /** Return the total size of the data pointer. Only defined if the length wa
s |
47 specified in the constructor or in a call to reset(). | 49 specified in the constructor or in a call to reset(). |
48 */ | 50 */ |
49 size_t size() const { return fStop - fData; } | 51 size_t size() const { return fStop - fData; } |
50 /** Return true if the buffer has read to the end of the data pointer. | 52 /** Return true if the buffer has read to the end of the data pointer. |
51 Only defined if the length was specified in the constructor or in a call | 53 Only defined if the length was specified in the constructor or in a call |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 161 |
160 private: | 162 private: |
161 void writeNoSizeCheck(const void* buffer, size_t size); | 163 void writeNoSizeCheck(const void* buffer, size_t size); |
162 | 164 |
163 char* fData; | 165 char* fData; |
164 char* fPos; | 166 char* fPos; |
165 char* fStop; | 167 char* fStop; |
166 }; | 168 }; |
167 | 169 |
168 #endif | 170 #endif |
OLD | NEW |