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

Unified Diff: src/images/SkImageDecoder_pkm.cpp

Issue 1604963002: SkStream/Priv cleanups (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update header description Created 4 years, 11 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/images/SkImageDecoder_libico.cpp ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_pkm.cpp
diff --git a/src/images/SkImageDecoder_pkm.cpp b/src/images/SkImageDecoder_pkm.cpp
index 71004614f51886d0270506444f0079221c8aaf35..098a4ee0aee44b6d80d3e35e1916be94a6c54f85 100644
--- a/src/images/SkImageDecoder_pkm.cpp
+++ b/src/images/SkImageDecoder_pkm.cpp
@@ -6,6 +6,7 @@
*/
#include "SkColorPriv.h"
+#include "SkData.h"
#include "SkImageDecoder.h"
#include "SkScaledBitmapSampler.h"
#include "SkStream.h"
@@ -33,13 +34,12 @@ private:
/////////////////////////////////////////////////////////////////////////////////////////
SkImageDecoder::Result SkPKMImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
- SkAutoMalloc autoMal;
- const size_t length = SkCopyStreamToStorage(&autoMal, stream);
- if (0 == length) {
+ SkAutoTUnref<SkData> data(SkCopyStreamToData(stream));
+ if (!data || !data->size()) {
return kFailure;
}
- unsigned char* buf = (unsigned char*)autoMal.get();
+ unsigned char* buf = (unsigned char*) data->data();
// Make sure original PKM header is there...
SkASSERT(etc1_pkm_is_valid(buf));
« no previous file with comments | « src/images/SkImageDecoder_libico.cpp ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698