Properly support png 1.5

Obtained from:	pkgsrc
This commit is contained in:
Antoine Brodin 2014-12-24 16:17:19 +00:00
parent 3fc19cdcb0
commit 18ca157619
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375470
2 changed files with 35 additions and 12 deletions

View File

@ -16,11 +16,11 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
GNU_CONFIGURE= YES
CFLAGS += -L${LOCALBASE}/lib -I${LOCALBASE}/include \
-I${LOCALBASE}/include/libpng15 ${PTHREAD_LIBS}
${PTHREAD_LIBS}
BUILD_DEPENDS+= gawk:${PORTSDIR}/lang/gawk
LIB_DEPENDS+= libhdf5.so:${PORTSDIR}/science/hdf5 \
libpng15.so:${PORTSDIR}/graphics/png \
libpng.so:${PORTSDIR}/graphics/png \
libmatheval.so:${PORTSDIR}/devel/libmatheval
.include <bsd.port.mk>

View File

@ -1,14 +1,19 @@
--- writepng.c.orig 2009-06-12 22:58:50.000000000 +0200
+++ writepng.c 2012-05-06 06:49:53.000000000 +0200
@@ -26,6 +26,7 @@
#include <string.h>
$NetBSD: patch-writepng.c,v 1.1 2011/02/01 09:05:31 wiz Exp $
Fix build with png-1.5.
--- writepng.c.orig 2009-06-12 20:58:50.000000000 +0000
+++ writepng.c
@@ -240,6 +240,8 @@ void writepng(char *filename,
double skewsin = sin(skew), skewcos = cos(skew);
REAL minoverlay = 0, maxoverlay = 0;
png_byte mask_byte;
+ png_colorp palette = NULL;
+
#include <png.h>
+#include <pngpriv.h>
#include "writepng.h"
@@ -309,7 +310,7 @@
/* we must use direct color for translucent overlays */
if (overlay)
@@ -309,7 +311,7 @@ void writepng(char *filename,
}
/* Set error handling. REQUIRED if you aren't supplying your own *
* error hadnling functions in the png_create_write_struct() call. */
@ -17,3 +22,21 @@
/* If we get here, we had a problem reading the file */
fclose(fp);
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
@@ -334,8 +336,6 @@ void writepng(char *filename,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
else {
- png_colorp palette;
-
png_set_IHDR(png_ptr, info_ptr, width, height, 8 /* bit_depth */ ,
PNG_COLOR_TYPE_PALETTE,
PNG_INTERLACE_NONE,
@@ -434,7 +434,7 @@ void writepng(char *filename,
png_write_end(png_ptr, info_ptr);
/* if you malloced the palette, free it here */
- free(info_ptr->palette);
+ free(palette);
/* if you allocated any text comments, free them here */