Index: src/images/SkImageDecoder_libwebp.cpp |
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp |
index d9434c281396c1cfe03ba9d05cdc71d0993e98d2..1618eb1e5fe54a80abc9ab8ea5708bb2da8aee14 100644 |
--- a/src/images/SkImageDecoder_libwebp.cpp |
+++ b/src/images/SkImageDecoder_libwebp.cpp |
@@ -113,6 +113,7 @@ protected: |
virtual bool onBuildTileIndex(SkStream *stream, int *width, int *height) SK_OVERRIDE; |
virtual bool onDecodeRegion(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRIDE; |
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; |
+ virtual Format onGetFormat(SkStream*) const SK_OVERRIDE; |
private: |
bool setDecodeConfig(SkBitmap* decodedBitmap, int width, int height); |
@@ -124,6 +125,14 @@ private: |
typedef SkImageDecoder INHERITED; |
}; |
+SkImageDecoder::Format SkWEBPImageDecoder::onGetFormat(SkStream* stream) const { |
+ int width, height, hasAlpha; |
+ if (webp_parse_header(stream, &width, &height, &hasAlpha)) { |
+ return kWEBP_Format; |
+ } |
+ return kUnknown_Format; |
+} |
+ |
////////////////////////////////////////////////////////////////////////// |
#ifdef TIME_DECODE |