tux4kids / t4kcommon

GNU General Public License v3.0
4 stars 11 forks source link

build failure with a newer PNG library (version 1.5.0 and up according to the docs) #2

Closed sonicth closed 3 years ago

sonicth commented 7 years ago

_infoptr is no longer defined globally. The following may fix the compile error occuring in _src/t4kloaders.c:

-               info_ptr->width = surf->w;
-               info_ptr->height = surf->h;
-               info_ptr->bit_depth = 8;
-               info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
-               info_ptr->interlace_type = 1;
-               info_ptr->valid = 0;    /* will be updated by various png_set_FOO() functions */
+               png_set_IHDR(png_ptr, info_ptr,
+                                        surf->w,
+                                        surf->h,
+                                        8, // bit_depth
+                                        PNG_COLOR_TYPE_RGB_ALPHA,
+                                        1, // interlace_type
+                                        PNG_COMPRESSION_TYPE_DEFAULT,
+                                        PNG_FILTER_TYPE_DEFAULT);
h01ger commented 3 years ago

this has been addressed, thus closing. and thanks still!

`commit 495af34788dcbae69f53a77d0bd70848b08b2de3 Author: nalin.x.linux nalin.x.linux@gmail.com Date: Wed Aug 22 22:54:20 2018 +0530

Since info_ptr is no longer directly accessible, set image header information in info_ptr using png_set_IHDR()

diff --git a/src/t4k_loaders.c b/src/t4k_loaders.c index ec66505..f69e5e5 100644 --- a/src/t4k_loaders.c +++ b/src/t4k_loaders.c @@ -1041,12 +1041,10 @@ static int do_png_save(FILE fi, const char const fname, SDL_Surface * surf) { png_init_io(png_ptr, fi);

`