package sdl_image: simplify patch

This commit is contained in:
Mark Brand 2011-03-06 10:40:14 +01:00
parent 3467773675
commit aeb4a0d7eb
1 changed files with 3 additions and 4 deletions

View File

@ -2,7 +2,7 @@ This file is part of mingw-cross-env.
See doc/index.html for further information.
diff --git a/IMG_png.c b/IMG_png.c
index a79fb9c..f85b6c8 100644
index a79fb9c..67af463 100644
--- a/IMG_png.c
+++ b/IMG_png.c
@@ -80,8 +80,13 @@ static struct {
@ -73,12 +73,11 @@ index a79fb9c..f85b6c8 100644
if ( surface == NULL ) {
error = "Out of memory";
goto done;
@@ -466,6 +491,12 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
@@ -466,6 +491,11 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
/* Load the palette, if any */
palette = surface->format->palette;
+#if (PNG_LIBPNG_VER >= 10500)
+ palette = surface->format->palette;
+ png_colorp info_palette = 0;
+ int info_num_palette = 0;
+ png_get_PLTE(png_ptr, info_ptr, &info_palette, &info_num_palette);
@ -86,7 +85,7 @@ index a79fb9c..f85b6c8 100644
if ( palette ) {
if(color_type == PNG_COLOR_TYPE_GRAY) {
palette->ncolors = 256;
@@ -474,12 +505,21 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
@@ -474,12 +504,21 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
palette->colors[i].g = i;
palette->colors[i].b = i;
}