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

Unified Diff: src/images/SkImageDecoder_wbmp.cpp

Issue 12604006: Upstream Android modifications to the image encoders/decoders. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: minor fixes Created 7 years, 9 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
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698