Index: src/images/SkImageDecoder_wbmp.cpp |
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp |
index c475ec126e9ec14ef677a938977c4b735fcb7ca4..5e395e592fbeba50077b0ff773cd36841370925e 100644 |
--- a/src/images/SkImageDecoder_wbmp.cpp |
+++ b/src/images/SkImageDecoder_wbmp.cpp |
@@ -17,12 +17,15 @@ |
class SkWBMPImageDecoder : public SkImageDecoder { |
public: |
- virtual Format getFormat() const { |
+ virtual Format getFormat() const SK_OVERRIDE { |
return kWBMP_Format; |
} |
protected: |
- virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode); |
+ virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; |
+ |
+private: |
+ typedef SkImageDecoder INHERITED; |
}; |
static bool read_byte(SkStream* stream, uint8_t* data) |
@@ -107,14 +110,21 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap, |
int width = head.fWidth; |
int height = head.fHeight; |
+ |
+ if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
+ decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height); |
+ decodedBitmap->setIsOpaque(true); |
+ return true; |
+ } |
+ |
+ // No Bitmap reuse supported for this format |
+ if (!decodedBitmap->isNull()) { |
+ return false; |
+ } |
- // assign these directly, in case we return kDimensions_Result |
decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height); |
decodedBitmap->setIsOpaque(true); |
- if (SkImageDecoder::kDecodeBounds_Mode == mode) |
- return true; |
- |
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE }; |
SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2)); |
SkAutoUnref aur(ct); |