Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 568683002: use SkData::NewUninitialized (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add SkStream::readIntoData Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/images/SkDecodingImageGenerator.cpp
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index 359eb370adc29c240f48338fc574fe33376c9017..46f4124648ea63ebfd8f6ec440fc8df036c4c661 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 = fStream->readIntoData(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,

Powered by Google App Engine
This is Rietveld 408576698