Index: include/images/SkImageDecoder.h |
diff --git a/include/images/SkImageDecoder.h b/include/images/SkImageDecoder.h |
index 38e77f4df765e7139f0f2507f57fbd4e0c00ae23..47e8a7b426dd5c4a4b3f7ead064614582426d02d 100644 |
--- a/include/images/SkImageDecoder.h |
+++ b/include/images/SkImageDecoder.h |
@@ -26,7 +26,6 @@ class SkImageDecoder { |
public: |
virtual ~SkImageDecoder(); |
- // Should be consistent with sFormatName |
enum Format { |
kUnknown_Format, |
kBMP_Format, |
@@ -37,14 +36,20 @@ public: |
kWBMP_Format, |
kWEBP_Format, |
- kLastKnownFormat = kWEBP_Format |
+ kLastKnownFormat = kWEBP_Format, |
+ kMultiple_Formats, |
scroggo
2013/04/22 22:10:16
Does this seem like the right place for kMultiple_
epoger
2013/04/23 16:03:41
This seems problematic to me. Maybe, instead, the
scroggo
2013/04/24 18:00:05
That seems reasonable to me. For now though, I'll
|
}; |
/** Return the format of image this decoder can decode. If this decoder can decode multiple |
- formats, kUnknown_Format will be returned. |
+ formats, returns kMultiple_Formats. |
*/ |
virtual Format getFormat() const; |
+ /** If this decoder can determine the format of stream, return its format. Otherwise return |
+ kUnknown_Format. |
epoger
2013/04/23 16:03:41
Please indicate what state the SkStream will be le
scroggo
2013/04/24 18:00:05
Done.
|
+ */ |
+ Format getFormat(SkStream*) const; |
+ |
/** Return a readable string of the value returned by getFormat(). |
*/ |
const char* getFormatName() const; |
scroggo
2013/04/22 22:10:16
Derek, does Android call this? (I assume I have ac
djsollen
2013/04/23 16:40:46
It is only used in a debug statement in the Bitmap
|
@@ -329,6 +334,10 @@ public: |
static void SetDeviceConfig(SkBitmap::Config); |
protected: |
+ // Override this in subclass to read a stream and determine its format. |
+ // No need to rewind the stream, which will be handled in getFormat. |
+ virtual Format onGetFormat(SkStream*) const; |
+ |
// must be overridden in subclasses. This guy is called by decode(...) |
virtual bool onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; |
@@ -416,13 +425,6 @@ private: |
mutable bool fShouldCancelDecode; |
bool fPreferQualityOverSpeed; |
- /** Contains the image format name. |
- * This should be consistent with Format. |
- * |
- * The format name gives a more meaningful error message than enum. |
- */ |
- static const char* sFormatName[]; |
- |
// illegal |
SkImageDecoder(const SkImageDecoder&); |
SkImageDecoder& operator=(const SkImageDecoder&); |