| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkImage.h" | 10 #include "SkImage.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 SkASSERT(fReader.available() > 0); | 110 SkASSERT(fReader.available() > 0); |
| 111 return *((uint8_t*) fReader.peek()); | 111 return *((uint8_t*) fReader.peek()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void SkReadBuffer::readString(SkString* string) { | 114 void SkReadBuffer::readString(SkString* string) { |
| 115 size_t len; | 115 size_t len; |
| 116 const char* strContents = fReader.readString(&len); | 116 const char* strContents = fReader.readString(&len); |
| 117 string->set(strContents, len); | 117 string->set(strContents, len); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void* SkReadBuffer::readEncodedString(size_t* length, SkPaint::TextEncoding enco
ding) { | |
| 121 SkDEBUGCODE(int32_t encodingType = ) fReader.readInt(); | |
| 122 SkASSERT(encodingType == encoding); | |
| 123 *length = fReader.readInt(); | |
| 124 void* data = sk_malloc_throw(*length); | |
| 125 memcpy(data, fReader.skip(SkAlign4(*length)), *length); | |
| 126 return data; | |
| 127 } | |
| 128 | |
| 129 void SkReadBuffer::readPoint(SkPoint* point) { | 120 void SkReadBuffer::readPoint(SkPoint* point) { |
| 130 point->fX = fReader.readScalar(); | 121 point->fX = fReader.readScalar(); |
| 131 point->fY = fReader.readScalar(); | 122 point->fY = fReader.readScalar(); |
| 132 } | 123 } |
| 133 | 124 |
| 134 void SkReadBuffer::readMatrix(SkMatrix* matrix) { | 125 void SkReadBuffer::readMatrix(SkMatrix* matrix) { |
| 135 fReader.readMatrix(matrix); | 126 fReader.readMatrix(matrix); |
| 136 } | 127 } |
| 137 | 128 |
| 138 void SkReadBuffer::readIRect(SkIRect* rect) { | 129 void SkReadBuffer::readIRect(SkIRect* rect) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return; | 403 return; |
| 413 } | 404 } |
| 414 } else { | 405 } else { |
| 415 if (nullptr == this->readFunctionPtr()) { | 406 if (nullptr == this->readFunctionPtr()) { |
| 416 return; | 407 return; |
| 417 } | 408 } |
| 418 } | 409 } |
| 419 uint32_t sizeRecorded = fReader.readU32(); | 410 uint32_t sizeRecorded = fReader.readU32(); |
| 420 fReader.skip(sizeRecorded); | 411 fReader.skip(sizeRecorded); |
| 421 } | 412 } |
| OLD | NEW |