summaryrefslogtreecommitdiff
path: root/sysutils/xnc
diff options
context:
space:
mode:
authorwiz <wiz>2011-04-05 11:56:30 +0000
committerwiz <wiz>2011-04-05 11:56:30 +0000
commit798ab8e4fd0ab1f847ddd1674b6776095302c4d8 (patch)
tree8b2e936521dd504ca358d4cd08a0fde6b2e72c23 /sysutils/xnc
parentbac5fecb34f9b878c31d149b2dade55227002e3a (diff)
downloadpkgsrc-798ab8e4fd0ab1f847ddd1674b6776095302c4d8.tar.gz
Fix build with png-1.5.
Diffstat (limited to 'sysutils/xnc')
-rw-r--r--sysutils/xnc/distinfo3
-rw-r--r--sysutils/xnc/patches/patch-src_lib_image2_sdl__image_IMG__png.c66
2 files changed, 68 insertions, 1 deletions
diff --git a/sysutils/xnc/distinfo b/sysutils/xnc/distinfo
index d420fc43b78..8c92a4e323a 100644
--- a/sysutils/xnc/distinfo
+++ b/sysutils/xnc/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2006/06/08 15:20:20 joerg Exp $
+$NetBSD: distinfo,v 1.8 2011/04/05 11:56:30 wiz Exp $
SHA1 (xnc-5.0.4.src.tar.gz) = 4673ba128f4df88342bfd4968a2427e894f6f3cb
RMD160 (xnc-5.0.4.src.tar.gz) = 46366a75eca41f10f68ae7d4ad95b76ed4d576e2
@@ -7,3 +7,4 @@ SHA1 (patch-aa) = 2da27a17e9b5c114b9ff930c38f8ec04b7221abc
SHA1 (patch-ab) = 2ec2bbbc1eb542527c5e45756a10e91337b7719d
SHA1 (patch-ak) = 8174f9791016fbaa179efbefa4971423677f7652
SHA1 (patch-am) = 5522a4a41bf5e0512f38017c28300cc9529c9c23
+SHA1 (patch-src_lib_image2_sdl__image_IMG__png.c) = 63b12a13d81a608c141f9383a4f745d14beaed1e
diff --git a/sysutils/xnc/patches/patch-src_lib_image2_sdl__image_IMG__png.c b/sysutils/xnc/patches/patch-src_lib_image2_sdl__image_IMG__png.c
new file mode 100644
index 00000000000..df4e89943ce
--- /dev/null
+++ b/sysutils/xnc/patches/patch-src_lib_image2_sdl__image_IMG__png.c
@@ -0,0 +1,66 @@
+$NetBSD: patch-src_lib_image2_sdl__image_IMG__png.c,v 1.1 2011/04/05 11:56:30 wiz Exp $
+
+Fix build with png-1.5.
+
+--- src/lib/image2/sdl_image/IMG_png.c.orig 2002-08-05 10:43:09.000000000 +0000
++++ src/lib/image2/sdl_image/IMG_png.c
+@@ -138,7 +138,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ * the normal method of doing things with libpng). REQUIRED unless you
+ * set up your own error handlers in png_create_read_struct() earlier.
+ */
+- if ( setjmp(png_ptr->jmpbuf) ) {
++ if ( setjmp(png_jmpbuf(png_ptr)) ) {
+ IMG_SetError("Error reading the PNG file.");
+ goto done;
+ }
+@@ -207,9 +207,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ Rmask = 0x000000FF;
+ Gmask = 0x0000FF00;
+ Bmask = 0x00FF0000;
+- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
++ Amask = (png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0;
+ } else {
+- int s = (info_ptr->channels == 4) ? 0 : 8;
++ int s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
+ Rmask = 0xFF000000 >> s;
+ Gmask = 0x00FF0000 >> s;
+ Bmask = 0x0000FF00 >> s;
+@@ -217,7 +217,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ }
+ }
+ surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
+- bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask);
++ bit_depth*png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask);
+ if ( surface == NULL ) {
+ IMG_SetError("Out of memory");
+ goto done;
+@@ -255,6 +255,10 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ /* Load the palette, if any */
+ palette = surface->format->palette;
+ if ( palette ) {
++ png_colorp pngpalette;
++ int pngnum_palette;
++
++ png_get_PLTE(png_ptr, info_ptr, &pngpalette, &pngnum_palette);
+ if(color_type == PNG_COLOR_TYPE_GRAY) {
+ palette->ncolors = 256;
+ for(i = 0; i < 256; i++) {
+@@ -262,12 +266,12 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ palette->colors[i].g = i;
+ palette->colors[i].b = i;
+ }
+- } else if (info_ptr->num_palette > 0 ) {
+- palette->ncolors = info_ptr->num_palette;
+- for( i=0; i<info_ptr->num_palette; ++i ) {
+- palette->colors[i].b = info_ptr->palette[i].blue;
+- palette->colors[i].g = info_ptr->palette[i].green;
+- palette->colors[i].r = info_ptr->palette[i].red;
++ } else if (pngnum_palette > 0 ) {
++ palette->ncolors = pngnum_palette;
++ for( i=0; i<pngnum_palette; ++i ) {
++ palette->colors[i].b = pngpalette[i].blue;
++ palette->colors[i].g = pngpalette[i].green;
++ palette->colors[i].r = pngpalette[i].red;
+ }
+ }
+ }