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

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 565803005: use SkData::NewUninitialized (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: readInData -> NewFromStream 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
« no previous file with comments | « src/core/SkStream.cpp ('k') | tests/MallocPixelRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « src/core/SkStream.cpp ('k') | tests/MallocPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698