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

Unified Diff: src/images/SkImageDecoder_libbmp.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_ktx.cpp ('k') | src/images/SkImageDecoder_libgif.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libbmp.cpp
diff --git a/src/images/SkImageDecoder_libbmp.cpp b/src/images/SkImageDecoder_libbmp.cpp
index 7b87e40039d48b582610ab271b6def44bac1da64..af868e30a72cd41708aefa61a31d4644ea722747 100644
--- a/src/images/SkImageDecoder_libbmp.cpp
+++ b/src/images/SkImageDecoder_libbmp.cpp
@@ -24,7 +24,7 @@ public:
}
protected:
- virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode mode) SK_OVERRIDE;
+ virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode mode) SK_OVERRIDE;
private:
typedef SkImageDecoder INHERITED;
@@ -92,7 +92,7 @@ private:
bool fJustBounds;
};
-bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
+SkImageDecoder::Result SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
// First read the entire stream, so that all of the data can be passed to
// the BmpDecoderHelper.
@@ -101,7 +101,7 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
// Byte length of all of the data.
const size_t length = SkCopyStreamToStorage(&storage, stream);
if (0 == length) {
- return 0;
+ return kFailure;
}
const bool justBounds = SkImageDecoder::kDecodeBounds_Mode == mode;
@@ -113,7 +113,7 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
const int max_pixels = 16383*16383; // max width*height
if (!helper.DecodeImage((const char*)storage.get(), length,
max_pixels, &callback)) {
- return false;
+ return kFailure;
}
}
@@ -136,17 +136,17 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
colorType, kOpaque_SkAlphaType));
if (justBounds) {
- return true;
+ return kSuccess;
}
if (!this->allocPixelRef(bm, NULL)) {
- return false;
+ return kFailure;
}
SkAutoLockPixels alp(*bm);
if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, *this)) {
- return false;
+ return kFailure;
}
const int srcRowBytes = width * 3;
@@ -158,5 +158,5 @@ bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
sampler.next(srcRow);
srcRow += sampler.srcDY() * srcRowBytes;
}
- return true;
+ return kSuccess;
}
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | src/images/SkImageDecoder_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698