Index: src/images/SkImageDecoder_libpng.cpp |
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp |
index 7911a293f67efc953182dfcf320463b9da2e9ef7..3c2070cc316770315abd077b96c0f9f76810862b 100644 |
--- a/src/images/SkImageDecoder_libpng.cpp |
+++ b/src/images/SkImageDecoder_libpng.cpp |
@@ -91,7 +91,7 @@ protected: |
virtual bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) SK_OVERRIDE; |
virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& region) SK_OVERRIDE; |
#endif |
- virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; |
+ virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; |
private: |
SkPNGImageIndex* fImageIndex; |
@@ -297,19 +297,19 @@ bool SkPNGImageDecoder::onDecodeInit(SkStream* sk_stream, png_structp *png_ptrp, |
return true; |
} |
-bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
- Mode mode) { |
+SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
+ Mode mode) { |
png_structp png_ptr; |
png_infop info_ptr; |
if (!onDecodeInit(sk_stream, &png_ptr, &info_ptr)) { |
- return false; |
+ return kFailure; |
} |
PNGAutoClean autoClean(png_ptr, info_ptr); |
if (setjmp(png_jmpbuf(png_ptr))) { |
- return false; |
+ return kFailure; |
} |
png_uint_32 origWidth, origHeight; |
@@ -322,7 +322,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
SkPMColor theTranspColor = 0; // 0 tells us not to try to match |
if (!this->getBitmapColorType(png_ptr, info_ptr, &colorType, &hasAlpha, &theTranspColor)) { |
- return false; |
+ return kFailure; |
} |
SkAlphaType alphaType = this->getRequireUnpremultipliedColors() ? |
@@ -333,7 +333,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
colorType, alphaType)); |
if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
- return true; |
+ return kSuccess; |
} |
// from here down we are concerned with colortables and pixels |
@@ -352,7 +352,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
if (!this->allocPixelRef(decodedBitmap, |
kIndex_8_SkColorType == colorType ? colorTable : NULL)) { |
- return false; |
+ return kFailure; |
} |
SkAutoLockPixels alp(*decodedBitmap); |
@@ -410,7 +410,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
*/ |
SkAutoLockColors ctLock(colorTable); |
if (!sampler.begin(decodedBitmap, sc, *this, ctLock.colors())) { |
- return false; |
+ return kFailure; |
} |
const int height = decodedBitmap->height(); |
@@ -467,7 +467,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
// Fall through. |
case kARGB_4444_SkColorType: |
// We have chosen not to support unpremul for these colortypes. |
- return false; |
+ return kFailure; |
default: { |
// Fall through to finish the decode. This colortype either |
// supports unpremul or it is irrelevant because it has no |
@@ -480,7 +480,7 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap, |
if (!reallyHasAlpha) { |
decodedBitmap->setAlphaType(kOpaque_SkAlphaType); |
} |
- return true; |
+ return kSuccess; |
} |