Applied #12959: Fix build with libpng-1.5
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@67009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -529,7 +529,7 @@ wxPNGHandler::LoadFile(wxImage *image,
|
||||
png_structp png_ptr = png_create_read_struct
|
||||
(
|
||||
PNG_LIBPNG_VER_STRING,
|
||||
(voidp) NULL,
|
||||
NULL,
|
||||
wx_png_error,
|
||||
wx_png_warning
|
||||
);
|
||||
@@ -586,16 +586,19 @@ wxPNGHandler::LoadFile(wxImage *image,
|
||||
#if wxUSE_PALETTE
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
const size_t ncolors = info_ptr->num_palette;
|
||||
int ncolors = 0;
|
||||
png_colorp palette;
|
||||
png_get_PLTE( png_ptr, info_ptr, &palette, &ncolors);
|
||||
unsigned char* r = new unsigned char[ncolors];
|
||||
unsigned char* g = new unsigned char[ncolors];
|
||||
unsigned char* b = new unsigned char[ncolors];
|
||||
int j;
|
||||
|
||||
for (size_t j = 0; j < ncolors; j++)
|
||||
for (j = 0; j < ncolors; j++)
|
||||
{
|
||||
r[j] = info_ptr->palette[j].red;
|
||||
g[j] = info_ptr->palette[j].green;
|
||||
b[j] = info_ptr->palette[j].blue;
|
||||
r[j] = palette[j].red;
|
||||
g[j] = palette[j].green;
|
||||
b[j] = palette[j].blue;
|
||||
}
|
||||
|
||||
image->SetPalette(wxPalette(ncolors, r, g, b));
|
||||
|
||||
Reference in New Issue
Block a user