Break onEncode() into two functions to avoid clobbering variables with
setjmp/longjmp; gets rid of warnings on Linux.
Over-the-shoulder review by reed@.
git-svn-id: http://skia.googlecode.com/svn/trunk@1989 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 67214e9..cefbe5e 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -702,6 +702,11 @@
class SkPNGImageEncoder : public SkImageEncoder {
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
+private:
+ bool doEncode(SkWStream* stream, const SkBitmap& bm,
+ const bool& hasAlpha, int colorType,
+ int bitDepth, SkBitmap::Config config,
+ png_color_8& sig_bit);
};
bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
@@ -764,6 +769,15 @@
bitDepth = computeBitDepth(ctable->count());
}
+ return doEncode(stream, bitmap, hasAlpha, colorType,
+ bitDepth, config, sig_bit);
+}
+
+bool SkPNGImageEncoder::doEncode(SkWStream* stream, const SkBitmap& bitmap,
+ const bool& hasAlpha, int colorType,
+ int bitDepth, SkBitmap::Config config,
+ png_color_8& sig_bit) {
+
png_structp png_ptr;
png_infop info_ptr;