OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkErrorInternals.h" | 9 #include "SkErrorInternals.h" |
10 #include "SkValidatingReadBuffer.h" | 10 #include "SkValidatingReadBuffer.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 void SkValidatingReadBuffer::readRect(SkRect* rect) { | 141 void SkValidatingReadBuffer::readRect(SkRect* rect) { |
142 const void* ptr = this->skip(sizeof(SkRect)); | 142 const void* ptr = this->skip(sizeof(SkRect)); |
143 if (!fError) { | 143 if (!fError) { |
144 memcpy(rect, ptr, sizeof(SkRect)); | 144 memcpy(rect, ptr, sizeof(SkRect)); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
| 148 void SkValidatingReadBuffer::readRRect(SkRRect* rrect) { |
| 149 const void* ptr = this->skip(sizeof(SkRRect)); |
| 150 if (!fError) { |
| 151 memcpy(rrect, ptr, sizeof(SkRRect)); |
| 152 } |
| 153 } |
| 154 |
148 void SkValidatingReadBuffer::readRegion(SkRegion* region) { | 155 void SkValidatingReadBuffer::readRegion(SkRegion* region) { |
149 size_t size = 0; | 156 size_t size = 0; |
150 if (!fError) { | 157 if (!fError) { |
151 size = region->readFromMemory(fReader.peek(), fReader.available()); | 158 size = region->readFromMemory(fReader.peek(), fReader.available()); |
152 this->validate((SkAlign4(size) == size) && (0 != size)); | 159 this->validate((SkAlign4(size) == size) && (0 != size)); |
153 } | 160 } |
154 if (!fError) { | 161 if (!fError) { |
155 (void)this->skip(size); | 162 (void)this->skip(size); |
156 } | 163 } |
157 } | 164 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 267 |
261 void SkValidatingReadBuffer::skipFlattenable() { | 268 void SkValidatingReadBuffer::skipFlattenable() { |
262 SkString name; | 269 SkString name; |
263 this->readString(&name); | 270 this->readString(&name); |
264 if (fError) { | 271 if (fError) { |
265 return; | 272 return; |
266 } | 273 } |
267 uint32_t sizeRecorded = this->readUInt(); | 274 uint32_t sizeRecorded = this->readUInt(); |
268 this->skip(sizeRecorded); | 275 this->skip(sizeRecorded); |
269 } | 276 } |
OLD | NEW |