From b201c236c8591beeed958359914bce412c92573a Mon Sep 17 00:00:00 2001 From: wiz Date: Mon, 7 Feb 2011 01:31:57 +0000 Subject: Fix build with png-1.5. --- graphics/gtksee/distinfo | 5 +- graphics/gtksee/patches/patch-src_detect.c | 28 ++++++++ graphics/gtksee/patches/patch-src_im__png.c | 102 ++++++++++++++++++++++++++++ graphics/gtksee/patches/patch-src_im__png.h | 15 ++++ 4 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 graphics/gtksee/patches/patch-src_detect.c create mode 100644 graphics/gtksee/patches/patch-src_im__png.c create mode 100644 graphics/gtksee/patches/patch-src_im__png.h (limited to 'graphics/gtksee') diff --git a/graphics/gtksee/distinfo b/graphics/gtksee/distinfo index b2c8f53fcaf..e38ebe424c5 100644 --- a/graphics/gtksee/distinfo +++ b/graphics/gtksee/distinfo @@ -1,6 +1,9 @@ -$NetBSD: distinfo,v 1.4 2010/02/03 23:03:26 joerg Exp $ +$NetBSD: distinfo,v 1.5 2011/02/07 01:31:57 wiz Exp $ SHA1 (gtksee-0.5.6.tar.gz) = 7e1050d26b8fea0403e2e9124956478828e58e0f RMD160 (gtksee-0.5.6.tar.gz) = 0df689de66212445bfdcdfaa9dbb65792e1c3efd Size (gtksee-0.5.6.tar.gz) = 322313 bytes SHA1 (patch-aa) = 0fd5b2367f5ee00d2a8a6b3d9c02725e5761f564 +SHA1 (patch-src_detect.c) = b93e1babed9913f2d3caac605d034d56cf724863 +SHA1 (patch-src_im__png.c) = a8c64c9c66bece8c4f976ad3212c1a4010eb7a5d +SHA1 (patch-src_im__png.h) = 042390ef7e886753d7605c0c5b97ace49c5612b4 diff --git a/graphics/gtksee/patches/patch-src_detect.c b/graphics/gtksee/patches/patch-src_detect.c new file mode 100644 index 00000000000..407df878639 --- /dev/null +++ b/graphics/gtksee/patches/patch-src_detect.c @@ -0,0 +1,28 @@ +$NetBSD: patch-src_detect.c,v 1.1 2011/02/07 01:31:57 wiz Exp $ + +Fix build with png-1.5. + +--- src/detect.c.orig 2004-02-14 15:16:33.000000000 +0000 ++++ src/detect.c +@@ -119,14 +119,16 @@ static gboolean + detect_png(guchar *filename, ImageInfo *info) + { + #ifdef HAVE_LIBPNG +- png_info pnginfo; ++ gint width; ++ gint height; ++ png_byte color_type; + +- if (png_get_header(filename, &pnginfo)) ++ if (png_get_header(filename, &width, &height, &color_type)) + { + info->type = PNG; +- info->width = pnginfo.width; +- info->height = pnginfo.height; +- switch (pnginfo.color_type) ++ info->width = width; ++ info->height = height; ++ switch (color_type) + { + case PNG_COLOR_TYPE_RGB : + info->ncolors = 24; diff --git a/graphics/gtksee/patches/patch-src_im__png.c b/graphics/gtksee/patches/patch-src_im__png.c new file mode 100644 index 00000000000..ff5ed8989d9 --- /dev/null +++ b/graphics/gtksee/patches/patch-src_im__png.c @@ -0,0 +1,102 @@ +$NetBSD: patch-src_im__png.c,v 1.1 2011/02/07 01:31:57 wiz Exp $ + +Fix build with png-1.5. + +--- src/im_png.c.orig 2004-02-14 15:16:33.000000000 +0000 ++++ src/im_png.c +@@ -55,7 +55,7 @@ my_error_exit(png_struct *pp, guchar *w) + */ + + gboolean +-png_get_header(gchar *filename, png_info *info) ++png_get_header(gchar *filename, gint *width, gint *height, png_bytep color_type) + { + png_struct *pp; + png_info *linfo; +@@ -99,10 +99,9 @@ png_get_header(gchar *filename, png_info + png_init_io(pp, fp); + png_read_info(pp, linfo); + +- info->width = linfo->width; +- info->height = linfo->height; +- info->valid = linfo->valid; +- info->color_type = linfo->color_type; ++ *width = png_get_image_width(pp, linfo); ++ *height = png_get_image_height(pp, linfo); ++ *color_type = png_get_color_type(pp, linfo); + + g_free(linfo); + g_free(pp); +@@ -161,26 +160,30 @@ png_load(gchar *filename, PngLoadFunc fu + png_init_io(pp, fp); + png_read_info(pp, info); + +- if (info->bit_depth < 8) ++ if (png_get_bit_depth(pp, info) < 8) + { + png_set_packing(pp); + png_set_expand(pp); + +- if (info->valid & PNG_INFO_sBIT) +- png_set_shift(pp, &(info->sig_bit)); ++ if (png_get_valid(pp, info, PNG_INFO_sBIT)) { ++ png_color_8p sig_bit; ++ png_get_sBIT(pp, info, &sig_bit); ++ ++ png_set_shift(pp, sig_bit); ++ } + } else +- if (info->bit_depth == 16) ++ if (png_get_bit_depth(pp, info) == 16) + png_set_strip_16(pp); + + /* + * Turn on interlace handling... + */ +- if (info->interlace_type) ++ if (png_get_interlace_type(pp, info)) + num_passes = png_set_interlace_handling(pp); + else + num_passes = 1; + +- switch (info->color_type) ++ switch (png_get_color_type(pp, info)) + { + case PNG_COLOR_TYPE_RGB : /* RGB */ + bpp = 3; +@@ -195,22 +198,30 @@ png_load(gchar *filename, PngLoadFunc fu + bpp = 2; + break; + case PNG_COLOR_TYPE_PALETTE : /* Indexed */ +- bpp = info->num_trans ? 4:3; ++ { ++ png_bytep trans_alpha; ++ int num_trans; ++ png_color_16p trans_color; ++ ++ png_get_tRNS(pp, info, &trans_alpha, &num_trans, &trans_color); ++ ++ bpp = num_trans ? 4:3; ++ } + break; + }; + +- pixel = g_malloc(sizeof(guchar) * info->width * bpp); ++ pixel = g_malloc(sizeof(guchar) * png_get_image_width(pp, info) * bpp); + + for (pass = 0; pass < num_passes; pass++) + { +- for (scanline = 0; scanline < info->height; scanline++) ++ for (scanline = 0; scanline < png_get_image_height(pp, info); scanline++) + { +- if (info->color_type == PNG_COLOR_TYPE_PALETTE) ++ if (png_get_color_type(pp, info) == PNG_COLOR_TYPE_PALETTE) + png_set_expand(pp); + + png_read_row(pp, pixel, NULL); + +- if ((*func) (pixel, info->width, 0, scanline, bpp, -1, 0)) goto png_read_cancelled; ++ if ((*func) (pixel, png_get_image_width(pp, info), 0, scanline, bpp, -1, 0)) goto png_read_cancelled; + }; + }; + diff --git a/graphics/gtksee/patches/patch-src_im__png.h b/graphics/gtksee/patches/patch-src_im__png.h new file mode 100644 index 00000000000..a8af885858b --- /dev/null +++ b/graphics/gtksee/patches/patch-src_im__png.h @@ -0,0 +1,15 @@ +$NetBSD: patch-src_im__png.h,v 1.1 2011/02/07 01:31:57 wiz Exp $ + +Fix build with png-1.5. + +--- src/im_png.h.orig 2004-02-14 15:16:33.000000000 +0000 ++++ src/im_png.h +@@ -31,7 +31,7 @@ + + typedef gboolean (*PngLoadFunc) (guchar *buffer, gint width, gint left, gint scanline, gint components, gint pass, gint mode); + +-gboolean png_get_header (gchar *filename, png_info *info); ++gboolean png_get_header (gchar *filename, gint *, gint *, png_bytep); + gboolean png_load (gchar *filename, PngLoadFunc func); + + #endif /* HAVE_LIBPNG */ -- cgit v1.2.3