X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39d16996b7616bf8090b140db74fd0b52d50d169..f357c0d42c17bf5be30e65e68cd99c474678da71:/src/common/imagpng.cpp diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index b1fea3c1fe..653c4effc8 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -54,10 +54,20 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) -#if wxUSE_LIBPNG +#if wxUSE_STREAMS #ifndef PNGLINKAGEMODE - #define PNGLINKAGEMODE LINKAGEMODE + #ifdef __WATCOMC__ + // we need an explicit cdecl for Watcom, at least according to + // + // http://sf.net/tracker/index.php?func=detail&aid=651492&group_id=9863&atid=109863 + // + // more testing is needed for this however, please remove this comment + // if you can confirm that my fix works with Watcom 11 + #define PNGLINKAGEMODE cdecl + #else + #define PNGLINKAGEMODE LINKAGEMODE + #endif #endif @@ -111,8 +121,8 @@ void PNGLINKAGEMODE wx_png_error(png_structp png_ptr, png_const_charp message) { wxPNGInfoStruct *info = WX_PNG_INFO(png_ptr); - if ( info->verbose ) - wxLogError(wxString(message)); + if (info->verbose) + wxLogError( wxString::FromAscii(message) ); #ifdef USE_FAR_KEYWORD { @@ -129,8 +139,8 @@ void PNGLINKAGEMODE wx_png_warning(png_structp png_ptr, png_const_charp message) { wxPNGInfoStruct *info = WX_PNG_INFO(png_ptr); - if ( info->verbose ) - wxLogWarning(wxString(message)); + if (info->verbose) + wxLogWarning( wxString::FromAscii(message) ); } } // extern "C" @@ -188,6 +198,10 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_expand( png_ptr ); + // Fix for Bug [ 439207 ] Monochrome PNG images come up black + if (bit_depth < 8) + png_set_expand( png_ptr ); + png_set_strip_16( png_ptr ); png_set_packing( png_ptr ); if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS))