pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/games/stratagus Fix build with png-1.5.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e5ffcec12285
branches:  trunk
changeset: 587195:e5ffcec12285
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Sun Apr 03 10:28:20 2011 +0000

description:
Fix build with png-1.5.

diffstat:

 games/stratagus/distinfo                      |   3 +-
 games/stratagus/patches/patch-src_video_png.c |  71 +++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletions(-)

diffs (89 lines):

diff -r b3a37bdb7b69 -r e5ffcec12285 games/stratagus/distinfo
--- a/games/stratagus/distinfo  Sun Apr 03 10:08:42 2011 +0000
+++ b/games/stratagus/distinfo  Sun Apr 03 10:28:20 2011 +0000
@@ -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-ac) = 78aca58075dd730a799dc9d0fb79ca4c6c010a34
 SHA1 (patch-ad) = 20dc341faf2fc160fbbd8b6ae68b1de1a9e21294
 SHA1 (patch-af) = 06e264e6a3fb785285da503f240405dedf851ec5
+SHA1 (patch-src_video_png.c) = fe1ac8d6c610b6f2e0dc259c98fc912b3259bfde
diff -r b3a37bdb7b69 -r e5ffcec12285 games/stratagus/patches/patch-src_video_png.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/games/stratagus/patches/patch-src_video_png.c     Sun Apr 03 10:28:20 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index