| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 *length = this->readInt(); | 112 *length = this->readInt(); |
| 113 const void* ptr = this->skip(SkAlign4(*length)); | 113 const void* ptr = this->skip(SkAlign4(*length)); |
| 114 void* data = NULL; | 114 void* data = NULL; |
| 115 if (!fError) { | 115 if (!fError) { |
| 116 data = sk_malloc_throw(*length); | 116 data = sk_malloc_throw(*length); |
| 117 memcpy(data, ptr, *length); | 117 memcpy(data, ptr, *length); |
| 118 } | 118 } |
| 119 return data; | 119 return data; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void SkValidatingReadBuffer::readPoint(SkPoint* point) { | |
| 123 point->fX = this->readScalar(); | |
| 124 point->fY = this->readScalar(); | |
| 125 } | |
| 126 | |
| 127 void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) { | 122 void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) { |
| 128 size_t size = 0; | 123 size_t size = 0; |
| 129 if (!fError) { | 124 if (!fError) { |
| 130 size = matrix->readFromMemory(fReader.peek(), fReader.available()); | 125 size = matrix->readFromMemory(fReader.peek(), fReader.available()); |
| 131 this->validate((SkAlign4(size) == size) && (0 != size)); | 126 this->validate((SkAlign4(size) == size) && (0 != size)); |
| 132 } | 127 } |
| 133 if (!fError) { | 128 if (!fError) { |
| 134 (void)this->skip(size); | 129 (void)this->skip(size); |
| 135 } | 130 } |
| 136 } | 131 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 258 |
| 264 void SkValidatingReadBuffer::skipFlattenable() { | 259 void SkValidatingReadBuffer::skipFlattenable() { |
| 265 SkString name; | 260 SkString name; |
| 266 this->readString(&name); | 261 this->readString(&name); |
| 267 if (fError) { | 262 if (fError) { |
| 268 return; | 263 return; |
| 269 } | 264 } |
| 270 uint32_t sizeRecorded = this->readUInt(); | 265 uint32_t sizeRecorded = this->readUInt(); |
| 271 this->skip(sizeRecorded); | 266 this->skip(sizeRecorded); |
| 272 } | 267 } |
| OLD | NEW |