Chromium Code Reviews| Index: include/core/SkImageDecoder.h |
| diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h |
| index 94831762deaf4f4ef58131e831769093761a5cc4..978eec98e5948cd8723790dc312258728f31c6b9 100644 |
| --- a/include/core/SkImageDecoder.h |
| +++ b/include/core/SkImageDecoder.h |
| @@ -225,6 +225,17 @@ public: |
| kDecodePixels_Mode //!< return entire bitmap (including pixels) |
| }; |
| + /** Result of a decode. If read as a boolean, a partial success is |
| + considered a success (true). |
| + */ |
| + enum Result { |
| + kFailure = 0, //!< Image failed to decode. bitmap will be |
|
reed1
2014/10/17 21:07:26
nit: why specify the actual numeric values? we rar
scroggo
2014/10/17 21:11:44
I suppose I could be more explicit, but that is ho
|
| + // unchanged. |
| + kPartialSuccess = 1, //!< Part of the image decoded. The rest is |
| + // filled in automatically |
| + kSuccess = 2 //!< The entire image decoded. |
| + }; |
| + |
| /** Given a stream, decode it into the specified bitmap. |
| If the decoder can decompress the image, it calls bitmap.setInfo(), |
| and then if the Mode is kDecodePixels_Mode, call allocPixelRef(), |
| @@ -244,8 +255,8 @@ public: |
| If a Peeker is installed via setPeeker, it may be used to peek into |
| meta data during the decode. |
| */ |
| - bool decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode); |
| - bool decode(SkStream* stream, SkBitmap* bitmap, Mode mode) { |
| + Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode); |
| + Result decode(SkStream* stream, SkBitmap* bitmap, Mode mode) { |
| return this->decode(stream, bitmap, kUnknown_SkColorType, mode); |
| } |
| @@ -334,7 +345,7 @@ public: |
| protected: |
| // must be overridden in subclasses. This guy is called by decode(...) |
| - virtual bool onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; |
| + virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; |
| // If the decoder wants to support tiled based decoding, |
| // this method must be overridden. This guy is called by buildTileIndex(...) |