diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-14 14:42:18 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-14 14:42:18 +0000 |
commit | a936e37cc76614868f5b489395bceeb340cc04cd (patch) | |
tree | 9cb0b81655baa1dc494079d2ae2aee37b3a084c2 /src/images/SkImageDecoder_wbmp.cpp | |
parent | 5439ea2e193c96274fb00ba0564b239e233d60a2 (diff) |
Upstream Android modifications to the image encoders/decoders.
This CL does not update the libjpeg as that change is large enough
to warrant its own CL.
Author: djsollen@google.com
Reviewed By: reed@google.com,robertphillips@google.com,scroggo@google.com
Review URL: https://chromiumcodereview.appspot.com/12604006
git-svn-id: http://skia.googlecode.com/svn/trunk@8155 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images/SkImageDecoder_wbmp.cpp')
-rw-r--r-- | src/images/SkImageDecoder_wbmp.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp index c475ec126e..5e395e592f 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); |