#if wxUSE_IMAGE && wxUSE_LIBPNG
#include "wx/imagpng.h"
+#include "wx/versioninfo.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
{
wxPNGInfoStruct *info = png_ptr ? WX_PNG_INFO(png_ptr) : NULL;
if ( !info || info->verbose )
+ {
wxLogWarning( wxString::FromAscii(message) );
+ }
}
// from pngerror.c
// must be opaque then as otherwise we shouldn't be
// using the mask at all
- wxASSERT_MSG( IsOpaque(a), _T("logic error") );
+ wxASSERT_MSG( IsOpaque(a), wxT("logic error") );
// fall through
{
// must be opaque then as otherwise we shouldn't be
// using the mask at all
- wxASSERT_MSG( IsOpaque(a), _T("logic error") );
+ wxASSERT_MSG( IsOpaque(a), wxT("logic error") );
// if we couldn't find a unique colour for the
// mask, we can have real pixels with the same
error:
if (verbose)
+ {
wxLogError(_("Couldn't load a PNG image - file is corrupted or not enough memory."));
+ }
if ( image->Ok() )
{
if (!png_ptr)
{
if (verbose)
+ {
wxLogError(_("Couldn't save PNG image."));
+ }
return false;
}
{
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
if (verbose)
+ {
wxLogError(_("Couldn't save PNG image."));
+ }
return false;
}
{
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
if (verbose)
+ {
wxLogError(_("Couldn't save PNG image."));
+ }
return false;
}
break;
default:
- wxFAIL_MSG( _T("unsupported image resolution units") );
+ wxFAIL_MSG( wxT("unsupported image resolution units") );
}
if ( resX && resY )
switch ( iColorType )
{
default:
- wxFAIL_MSG( _T("unknown wxPNG_TYPE_XXX") );
+ wxFAIL_MSG( wxT("unknown wxPNG_TYPE_XXX") );
// fall through
case wxPNG_TYPE_COLOUR:
#endif // wxUSE_STREAMS
+/*static*/ wxVersionInfo wxPNGHandler::GetLibraryVersionInfo()
+{
+ // The version string seems to always have a leading space and a trailing
+ // new line, get rid of them both.
+ wxString str = png_get_header_version(NULL) + 1;
+ str.Replace("\n", "");
+
+ return wxVersionInfo("libpng",
+ PNG_LIBPNG_VER_MAJOR,
+ PNG_LIBPNG_VER_MINOR,
+ PNG_LIBPNG_VER_RELEASE,
+ str);
+}
+
#endif // wxUSE_LIBPNG