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)); |