Index: src/images/SkDecodingImageGenerator.cpp |
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp |
index 359eb370adc29c240f48338fc574fe33376c9017..3b5cb784edd4254f2c7ce4b51ad7d4c2dfe02b4a 100644 |
--- a/src/images/SkDecodingImageGenerator.cpp |
+++ b/src/images/SkDecodingImageGenerator.cpp |
@@ -139,13 +139,11 @@ SkData* DecodingImageGenerator::onRefEncodedData() { |
return NULL; |
} |
size_t length = fStream->getLength(); |
- if (0 == length) { |
- return NULL; |
+ if (length) { |
+ fData = SkData::NewFromStream(fStream, length); |
} |
- fData = SkData::NewUninitialized(length); |
- SkCheckResult(fStream->read(fData->writable_data(), length), length); |
} |
- return SkRef(fData); |
+ return SkSafeRef(fData); |
} |
bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, |