openbsd-ports/graphics/imlib/patches/patch-gdk_imlib_io-png_c
naddy 8c18b08ac5 Fix build with png-1.5.
All fixes from/via NetBSD pkgsrc.  The people there did a lot of
heavy lifting.
2011-07-08 20:36:09 +00:00

73 lines
2.3 KiB
Plaintext

$OpenBSD: patch-gdk_imlib_io-png_c,v 1.4 2011/07/08 20:36:09 naddy Exp $
Fix build with png-1.5.
--- gdk_imlib/io-png.c.orig Mon Mar 4 10:06:29 2002
+++ gdk_imlib/io-png.c Mon Jul 4 17:01:55 2011
@@ -40,13 +40,13 @@ loader_png (FILE * f, int *w, int *h, int *t)
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -275,13 +275,13 @@ inline_png(unsigned char *data, int data_size)
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -301,6 +301,8 @@ inline_png(unsigned char *data, int data_size)
/* Setup Translators */
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+ png_set_expand(png_ptr);
png_set_strip_16(png_ptr);
png_set_packing(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
@@ -440,13 +442,13 @@ _loader_alpha_png (FILE * f, int *w, int *h, int *t, u
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -635,7 +637,7 @@ saver_png (GdkImlibImage *im, char *file, GdkImlibSave
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
return 0;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
fclose(f);
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);