|
|
b9944a9 |
diff -up SDL_image-1.2.12/IMG_png.c~ SDL_image-1.2.12/IMG_png.c
|
|
|
b9944a9 |
--- SDL_image-1.2.12/IMG_png.c~ 2012-01-21 02:51:33.000000000 +0100
|
|
|
b9944a9 |
+++ SDL_image-1.2.12/IMG_png.c 2015-12-26 12:39:21.150828413 +0100
|
|
|
b9944a9 |
@@ -95,6 +95,7 @@ static struct {
|
|
|
b9944a9 |
void (*png_set_packing) (png_structp png_ptr);
|
|
|
b9944a9 |
void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn);
|
|
|
b9944a9 |
void (*png_set_strip_16) (png_structp png_ptr);
|
|
|
b9944a9 |
+ int (*png_set_interlace_handling) (png_structp png_ptr);
|
|
|
b9944a9 |
int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check);
|
|
|
b9944a9 |
#ifndef LIBPNG_VERSION_12
|
|
|
b9944a9 |
jmp_buf* (*png_set_longjmp_fn) (png_structp, png_longjmp_ptr, size_t);
|
|
|
b9944a9 |
@@ -228,6 +229,13 @@ int IMG_InitPNG()
|
|
|
b9944a9 |
SDL_UnloadObject(lib.handle);
|
|
|
b9944a9 |
return -1;
|
|
|
b9944a9 |
}
|
|
|
b9944a9 |
+ lib.png_set_interlace_handling =
|
|
|
b9944a9 |
+ (void (*) (png_structp))
|
|
|
b9944a9 |
+ SDL_LoadFunction(lib.handle, "png_set_interlace_handling");
|
|
|
b9944a9 |
+ if ( lib.png_set_interlace_handling == NULL ) {
|
|
|
b9944a9 |
+ SDL_UnloadObject(lib.handle);
|
|
|
b9944a9 |
+ return -1;
|
|
|
b9944a9 |
+ }
|
|
|
b9944a9 |
lib.png_sig_cmp =
|
|
|
b9944a9 |
(int (*) (png_bytep, png_size_t, png_size_t))
|
|
|
b9944a9 |
SDL_LoadFunction(lib.handle, "png_sig_cmp");
|
|
|
b9944a9 |
@@ -280,6 +288,7 @@ int IMG_InitPNG()
|
|
|
b9944a9 |
lib.png_set_packing = png_set_packing;
|
|
|
b9944a9 |
lib.png_set_read_fn = png_set_read_fn;
|
|
|
b9944a9 |
lib.png_set_strip_16 = png_set_strip_16;
|
|
|
b9944a9 |
+ lib.png_set_interlace_handling = png_set_interlace_handling;
|
|
|
b9944a9 |
lib.png_sig_cmp = png_sig_cmp;
|
|
|
b9944a9 |
#ifndef LIBPNG_VERSION_12
|
|
|
b9944a9 |
lib.png_set_longjmp_fn = png_set_longjmp_fn;
|
|
|
b9944a9 |
@@ -404,6 +413,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
|
|
|
b9944a9 |
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
|
|
|
b9944a9 |
lib.png_set_strip_16(png_ptr) ;
|
|
|
b9944a9 |
|
|
|
b9944a9 |
+ /* tell libpng to de-interlace (if the image is interlaced) */
|
|
|
b9944a9 |
+ lib.png_set_interlace_handling(png_ptr) ;
|
|
|
b9944a9 |
+
|
|
|
b9944a9 |
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
|
|
|
b9944a9 |
* byte into separate bytes (useful for paletted and grayscale images).
|
|
|
b9944a9 |
*/
|