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

Unified Diff: src/images/SkImageDecoder_wbmp.cpp

Issue 647023006: Qualify the return value of SkImageDecoder::decode (Closed) Base URL: https://skia.googlesource.com/skia.git/+/master
Patch Set: fix a sample Created 6 years, 2 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_pkm.cpp ('k') | src/images/SkScaledBitmapSampler.cpp » ('j') | 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 0bf138940da8a50242aab08ea8a3384245eb6e3a..7a6f76ed3463186b5a39890ed07598756e0af594 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -22,7 +22,7 @@ public:
}
protected:
- virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
+ virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
private:
typedef SkImageDecoder INHERITED;
@@ -99,13 +99,13 @@ static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
}
}
-bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
- Mode mode)
+SkImageDecoder::Result SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
+ Mode mode)
{
wbmp_head head;
if (!head.init(stream)) {
- return false;
+ return kFailure;
}
int width = head.fWidth;
@@ -115,7 +115,7 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
kIndex_8_SkColorType, kOpaque_SkAlphaType));
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
- return true;
+ return kSuccess;
}
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
@@ -123,7 +123,7 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
SkAutoUnref aur(ct);
if (!this->allocPixelRef(decodedBitmap, ct)) {
- return false;
+ return kFailure;
}
SkAutoLockPixels alp(*decodedBitmap);
@@ -135,7 +135,7 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
size_t srcSize = height * srcRB;
uint8_t* src = dst + decodedBitmap->getSize() - srcSize;
if (stream->read(src, srcSize) != srcSize) {
- return false;
+ return kFailure;
}
for (int y = 0; y < height; y++)
@@ -145,7 +145,7 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
src += srcRB;
}
- return true;
+ return kSuccess;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/images/SkImageDecoder_pkm.cpp ('k') | src/images/SkScaledBitmapSampler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698