From d1f2cff621f88760158db7705acec7e3a443a15e Mon Sep 17 00:00:00 2001 From: Matt Jolly Date: Sat, 14 Sep 2024 18:44:49 +1000 Subject: [PATCH] Wrap `png_get_color_type` for Fpng Prior to this change the "without PNG" build path does not successfully build under Meson. Signed-off-by: Matt Jolly --- libs/Fpng.h | 4 +++- libs/PictureImageLoader.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/Fpng.h b/libs/Fpng.h index 54c91063a..f422c8c23 100644 --- a/libs/Fpng.h +++ b/libs/Fpng.h @@ -439,6 +439,7 @@ typedef Fpng_struct **Fpng_structpp; #define Fpng_destroy_read_struct(a,b,c) png_destroy_read_struct(a,b,c) #define Fpng_init_io(a,b) png_init_io(a,b) #define Fpng_read_info(a,b) png_read_info(a,b) +#define Fpng_get_color_type(a, b) png_get_color_type(a, b) #define Fpng_get_IHDR(a,b,c,d,e,f,g,h,i) png_get_IHDR(a,b,c,d,e,f,g,h,i) #define Fpng_set_expand(a) png_set_expand(a) #define Fpng_set_swap_alpha(a) png_set_swap_alpha(a) @@ -471,9 +472,10 @@ typedef Fpng_struct **Fpng_structpp; #define FPNG_INFO_tRNS 7 #define Fpng_check_sig(a,b) 0 -#define Fpng_create_read_struct(a,b,c,d) NULL #define Fpng_create_info_struct(a) NULL +#define Fpng_create_read_struct(a,b,c,d) NULL #define Fpng_destroy_read_struct(a,b,c) +#define Fpng_get_color_type(a, b) 0 #define Fpng_init_io(a,b) #define Fpng_read_info(a,b) #define Fpng_get_IHDR(a,b,c,d,e,f,g,h,i) diff --git a/libs/PictureImageLoader.c b/libs/PictureImageLoader.c index 35498a875..f6f56e758 100644 --- a/libs/PictureImageLoader.c +++ b/libs/PictureImageLoader.c @@ -480,16 +480,16 @@ Bool PImageLoadPng(FIMAGE_CMD_ARGS) * this fail to build on much older libpng versions which we support * (pre 1.3), then I might have to. */ - if (png_get_color_type(Fpng_ptr, Finfo_ptr) == FPNG_COLOR_TYPE_RGB_ALPHA) + if (Fpng_get_color_type(Fpng_ptr, Finfo_ptr) == FPNG_COLOR_TYPE_RGB_ALPHA) { hasa = 1; } - if (png_get_color_type(Fpng_ptr, Finfo_ptr) == FPNG_COLOR_TYPE_GRAY_ALPHA) + if (Fpng_get_color_type(Fpng_ptr, Finfo_ptr) == FPNG_COLOR_TYPE_GRAY_ALPHA) { hasa = 1; hasg = 1; } - if (png_get_color_type(Fpng_ptr, Finfo_ptr) == FPNG_COLOR_TYPE_GRAY) + if (Fpng_get_color_type(Fpng_ptr, Finfo_ptr) == FPNG_COLOR_TYPE_GRAY) { hasg = 1; }