don't read directly from fReader for bare types, need available check

Bug:792810
Change-Id: Ibb9d4b1dff05d48d7cb6674acf88a7a461bca818
Reviewed-on: https://skia-review.googlesource.com/82180
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-12-07 13:52:08 -05:00 committed by Skia Commit-Bot
parent 04460ccee5
commit 75d55d3d45

View File

@ -196,14 +196,14 @@ void SkReadBuffer::readColor4f(SkColor4f* color) {
}
void SkReadBuffer::readPoint(SkPoint* point) {
point->fX = fReader.readScalar();
point->fY = fReader.readScalar();
point->fX = this->readScalar();
point->fY = this->readScalar();
}
void SkReadBuffer::readPoint3(SkPoint3* point) {
point->fX = fReader.readScalar();
point->fY = fReader.readScalar();
point->fZ = fReader.readScalar();
point->fX = this->readScalar();
point->fY = this->readScalar();
point->fZ = this->readScalar();
}
void SkReadBuffer::readMatrix(SkMatrix* matrix) {
@ -417,7 +417,7 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
} else {
// Read the index. We are guaranteed that the first byte
// is zeroed, so we must shift down a byte.
uint32_t index = fReader.readU32() >> 8;
uint32_t index = this->read32() >> 8;
if (!this->validate(index > 0)) {
return nullptr; // writer failed to give us the flattenable
}
@ -440,7 +440,7 @@ SkFlattenable* SkReadBuffer::readFlattenable(SkFlattenable::Type ft) {
// if we get here, factory may still be null, but if that is the case, the
// failure was ours, not the writer.
sk_sp<SkFlattenable> obj;
uint32_t sizeRecorded = fReader.readU32();
uint32_t sizeRecorded = this->read32();
if (factory) {
size_t offset = fReader.offset();
obj = (*factory)(*this);