aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-28 21:06:40 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-28 21:06:40 +0000
commit5c210c7a2ff860631c179253d8d6f6d813185570 (patch)
treeb90ae7aca67b1799706b825653c761de2aa6f51a
parentd53bd4a40a4390d38d9836ed9e3c32cda4cbc2df (diff)
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
-rw-r--r--src/images/SkImageDecoder_libpng.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 67214e9fc7..cefbe5e71c 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -702,6 +702,11 @@ static inline int pack_palette(SkColorTable* ctable,
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 @@ bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap,
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;