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

Unified Diff: src/images/SkImageDecoder_libwebp.cpp

Issue 14363003: Updates to skimage tool to use it for testing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Implement onGetFormat for other decoders. Created 7 years, 8 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
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

Powered by Google App Engine
This is Rietveld 408576698