// Name: src/common/imagpng.cpp
// Purpose: wxImage PNG handler
// Author: Robert Roebling
-// RCS-ID: $Id$
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// First, let me describe what's the problem: libpng uses jmp_buf in
// its png_struct structure. Unfortunately, this structure is
// compiler-specific and may vary in size, so if you use libpng compiled
-// as DLL with another compiler than the main executable, it may not work
-// (this is for example the case with wxMGL port and SciTech MGL library
-// that provides custom runtime-loadable libpng implementation with jmpbuf
-// disabled altogether). Luckily, it is still possible to use setjmp() &
-// longjmp() as long as the structure is not part of png_struct.
+// as DLL with another compiler than the main executable, it may not work.
+// Luckily, it is still possible to use setjmp() & longjmp() as long as the
+// structure is not part of png_struct.
//
// Sadly, there's no clean way to attach user-defined data to png_struct.
// There is only one customizable place, png_struct.io_ptr, which is meant
}
static void
-PNGLINKAGEMODE wx_png_warning(png_structp png_ptr, png_const_charp message)
+PNGLINKAGEMODE wx_PNG_warning(png_structp png_ptr, png_const_charp message)
{
wxPNGInfoStruct *info = png_ptr ? WX_PNG_INFO(png_ptr) : NULL;
if ( !info || info->verbose )
// from pngerror.c
// so that the libpng doesn't send anything on stderr
static void
-PNGLINKAGEMODE wx_png_error(png_structp png_ptr, png_const_charp message)
+PNGLINKAGEMODE wx_PNG_error(png_structp png_ptr, png_const_charp message)
{
- wx_png_warning(NULL, message);
+ wx_PNG_warning(NULL, message);
// we're not using libpng built-in jump buffer (see comment before
// wxPNGInfoStruct above) so we have to return ourselves, otherwise libpng
(
PNG_LIBPNG_VER_STRING,
NULL,
- wx_png_error,
- wx_png_warning
+ wx_PNG_error,
+ wx_PNG_warning
);
if (!png_ptr)
goto error;
for (i = 0; i < height; i++)
{
- if ((lines[i] = (unsigned char *)malloc( (size_t)(width * (sizeof(unsigned char) * 4)))) == NULL)
+ if ((lines[i] = (unsigned char *)malloc( (size_t)(width * 4))) == NULL)
goto error;
}
(
PNG_LIBPNG_VER_STRING,
NULL,
- wx_png_error,
- wx_png_warning
+ wx_PNG_error,
+ wx_PNG_warning
);
if (!png_ptr)
{