summaryrefslogtreecommitdiff
path: root/games/stratagus
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2011-04-03 10:28:20 +0000
committerwiz <wiz@pkgsrc.org>2011-04-03 10:28:20 +0000
commit85bf58377b3f7e53837c57b2e20d37424f71cc34 (patch)
treed710e4deddc4bbeb49ae4306d13e18ea179bde07 /games/stratagus
parent3b3f41c41752359558e624feb05cfe129e0a6589 (diff)
downloadpkgsrc-85bf58377b3f7e53837c57b2e20d37424f71cc34.tar.gz
Fix build with png-1.5.
Diffstat (limited to 'games/stratagus')
-rw-r--r--games/stratagus/distinfo3
-rw-r--r--games/stratagus/patches/patch-src_video_png.c71
2 files changed, 73 insertions, 1 deletions
diff --git a/games/stratagus/distinfo b/games/stratagus/distinfo
index 46dd3695aca..f85a003be22 100644
--- a/games/stratagus/distinfo
+++ b/games/stratagus/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2007/01/12 20:32:48 wiz Exp $
+$NetBSD: distinfo,v 1.7 2011/04/03 10:28:20 wiz Exp $
SHA1 (stratagus-2.1-src.tar.gz) = 33181d57e018825a450f1e8c0ec31b0887cbd39c
RMD160 (stratagus-2.1-src.tar.gz) = f5f97854cad9f17104de34613012fd3aa2efbb9b
@@ -8,3 +8,4 @@ SHA1 (patch-ab) = cd9235023dcb2bc05828857c8f1d538a0d06eab5
SHA1 (patch-ac) = 78aca58075dd730a799dc9d0fb79ca4c6c010a34
SHA1 (patch-ad) = 20dc341faf2fc160fbbd8b6ae68b1de1a9e21294
SHA1 (patch-af) = 06e264e6a3fb785285da503f240405dedf851ec5
+SHA1 (patch-src_video_png.c) = fe1ac8d6c610b6f2e0dc259c98fc912b3259bfde
diff --git a/games/stratagus/patches/patch-src_video_png.c b/games/stratagus/patches/patch-src_video_png.c
new file mode 100644
index 00000000000..dcc186de482
--- /dev/null
+++ b/games/stratagus/patches/patch-src_video_png.c
@@ -0,0 +1,71 @@
+$NetBSD: patch-src_video_png.c,v 1.1 2011/04/03 10:28:21 wiz Exp $
+
+Fix build with png-1.5.
+
+--- src/video/png.c.orig 2004-06-26 22:38:20.000000000 +0000
++++ src/video/png.c
+@@ -133,7 +133,7 @@ Graphic* LoadGraphicPNG(const char* name
+ * 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))) {
+ fprintf(stderr, "Error reading the PNG file.");
+ goto done;
+ }
+@@ -212,11 +212,11 @@ Graphic* LoadGraphicPNG(const char* name
+ 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;
+
+- s = (info_ptr->channels == 4) ? 0 : 8;
++ s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
+ Rmask = 0xFF000000 >> s;
+ Gmask = 0x00FF0000 >> s;
+ Bmask = 0x0000FF00 >> s;
+@@ -224,7 +224,7 @@ Graphic* LoadGraphicPNG(const char* name
+ }
+ }
+ 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) {
+ fprintf(stderr, "Out of memory");
+ goto done;
+@@ -270,12 +270,17 @@ Graphic* LoadGraphicPNG(const char* name
+ 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 {
++ png_colorp pngpalette;
++ int num_palette;
++ png_get_PLTE(png_ptr, info_ptr, &pngpalette, &num_palette);
++ if (num_palette > 0) {
++ palette->ncolors = num_palette;
++ for (i = 0; i < num_palette; ++i) {
++ palette->colors[i].b = pngpalette[i].blue;
++ palette->colors[i].g = pngpalette[i].green;
++ palette->colors[i].r = pngpalette[i].red;
++ }
+ }
+ }
+ }
+@@ -331,7 +336,7 @@ void SaveScreenshotPNG(const char* name)
+ return;
+ }
+
+- if (setjmp(png_ptr->jmpbuf)) {
++ if (setjmp(png_jmpbuf(png_ptr))) {
+ /* If we get here, we had a problem reading the file */
+ fclose(fp);
+ png_destroy_write_struct(&png_ptr, &info_ptr);