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

Unified Diff: src/images/SkImageDecoder_libgif.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_libbmp.cpp ('k') | src/images/SkImageDecoder_libico.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libgif.cpp
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 81071c95158be16957e20d3fdfb0ad3554ade7ce..fb5d18fc0870b1be25caf18aaea110aa5867186a 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.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;
@@ -152,14 +152,15 @@ static int find_transpIndex(const SavedImage& image, int colorCount) {
return transpIndex;
}
-static bool error_return(const SkBitmap& bm, const char msg[]) {
+static SkImageDecoder::Result error_return(const SkBitmap& bm, const char msg[]) {
if (!c_suppressGIFImageDecoderWarnings) {
SkDebugf("libgif error [%s] bitmap [%d %d] pixels %p colortable %p\n",
msg, bm.width(), bm.height(), bm.getPixels(),
bm.getColorTable());
}
- return false;
+ return SkImageDecoder::kFailure;
}
+
static void gif_warning(const SkBitmap& bm, const char msg[]) {
if (!c_suppressGIFImageDecoderWarnings) {
SkDebugf("libgif warning [%s] bitmap [%d %d] pixels %p colortable %p\n",
@@ -228,7 +229,7 @@ static void sanitize_indexed_bitmap(SkBitmap* bm) {
}
}
-bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
+SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
#if GIFLIB_MAJOR < 5
GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc);
#else
@@ -322,7 +323,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
kIndex_8_SkColorType, kPremul_SkAlphaType));
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
- return true;
+ return kSuccess;
}
@@ -423,7 +424,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
sampler.sampleInterlaced(scanline, iter.currY());
iter.next();
}
- return true;
+ return kPartialSuccess;
}
sampler.sampleInterlaced(scanline, iter.currY());
iter.next();
@@ -439,7 +440,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
for (; y < outHeight; y++) {
sampler.next(scanline);
}
- return true;
+ return kPartialSuccess;
}
// scanline now contains the raw data. Sample it.
sampler.next(scanline);
@@ -453,7 +454,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
skip_src_rows(gif, scanline, innerWidth, innerHeight - read);
}
sanitize_indexed_bitmap(bm);
- return true;
+ return kSuccess;
} break;
case EXTENSION_RECORD_TYPE:
@@ -498,7 +499,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
} while (recType != TERMINATE_RECORD_TYPE);
sanitize_indexed_bitmap(bm);
- return true;
+ return kSuccess;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/images/SkImageDecoder_libbmp.cpp ('k') | src/images/SkImageDecoder_libico.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698