Index: src/codec/SkBmpCodec.cpp |
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp |
index 580ff25ddd21a70749343fb6cb6de91ffdb5c88d..3302e4f752eb74826b6142d1d3e04535e393f816 100644 |
--- a/src/codec/SkBmpCodec.cpp |
+++ b/src/codec/SkBmpCodec.cpp |
@@ -56,12 +56,10 @@ enum BmpInputFormat { |
/* |
* Checks the start of the stream to see if the image is a bitmap |
*/ |
-bool SkBmpCodec::IsBmp(SkStream* stream) { |
+bool SkBmpCodec::IsBmp(const void* buffer, size_t bytesRead) { |
// TODO: Support "IC", "PT", "CI", "CP", "BA" |
const char bmpSig[] = { 'B', 'M' }; |
- char buffer[sizeof(bmpSig)]; |
- return stream->read(buffer, sizeof(bmpSig)) == sizeof(bmpSig) && |
- !memcmp(buffer, bmpSig, sizeof(bmpSig)); |
+ return bytesRead >= sizeof(bmpSig) && !memcmp(buffer, bmpSig, sizeof(bmpSig)); |
} |
/* |