Index: src/codec/SkCodec.cpp |
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp |
index 69d95a41da24be0231cdd32b8719d2b1d6ea3747..75c0ca1244c308d6b9f84ddfd315c295808477f3 100644 |
--- a/src/codec/SkCodec.cpp |
+++ b/src/codec/SkCodec.cpp |
@@ -7,6 +7,7 @@ |
#include "SkCodec.h" |
#include "SkData.h" |
+#include "SkCodec_libbmp.h" |
#include "SkCodec_libpng.h" |
#include "SkStream.h" |
@@ -15,6 +16,14 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream) { |
return NULL; |
} |
SkAutoTDelete<SkStream> streamDeleter(stream); |
+ const bool isBmp = SkBmpCodec::IsBmp(stream); |
+ if (!stream->rewind()) { |
+ return NULL; |
+ } |
+ if (isBmp) { |
+ streamDeleter.detach(); |
+ return SkBmpCodec::NewFromStream(stream); |
+ } |
const bool isPng = SkPngCodec::IsPng(stream); |
scroggo
2015/03/06 18:56:12
nit: PNG should be first, since we'll see more PNG
|
if (!stream->rewind()) { |
return NULL; |