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

Unified Diff: src/images/SkImageDecoder_astc.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/core/SkStreamPriv.h ('k') | src/images/SkImageDecoder_libbmp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_astc.cpp
diff --git a/src/images/SkImageDecoder_astc.cpp b/src/images/SkImageDecoder_astc.cpp
index e1a6a06fa7588ce8fdc470b87c00d352c077a5a3..8989464f3b8d0ee4d25989de165f5c60b5b0963f 100644
--- a/src/images/SkImageDecoder_astc.cpp
+++ b/src/images/SkImageDecoder_astc.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkData.h"
#include "SkEndian.h"
#include "SkColorPriv.h"
#include "SkImageDecoder.h"
@@ -43,13 +44,12 @@ static inline int read_24bit(const uint8_t* buf) {
}
SkImageDecoder::Result SkASTCImageDecoder::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 that the magic header is there...
SkASSERT(SkEndian_SwapLE32(*(reinterpret_cast<uint32_t*>(buf))) == kASTCMagicNumber);
« no previous file with comments | « src/core/SkStreamPriv.h ('k') | src/images/SkImageDecoder_libbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698