summaryrefslogtreecommitdiff
path: root/graphics/SDL_image
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2011-01-16 12:51:24 +0000
committerwiz <wiz@pkgsrc.org>2011-01-16 12:51:24 +0000
commit5fa2a5e4426739e203fec38653b82cbf3e01847c (patch)
treecdff9285c05d4ed6a6fbb0c1fdeb200c05b51e8d /graphics/SDL_image
parent2da3de7b9e51d7629d30bbcb577e717e9b1cc749 (diff)
downloadpkgsrc-5fa2a5e4426739e203fec38653b82cbf3e01847c.tar.gz
Start fixing build, final bits missing.
Diffstat (limited to 'graphics/SDL_image')
-rw-r--r--graphics/SDL_image/distinfo3
-rw-r--r--graphics/SDL_image/patches/patch-aa112
2 files changed, 114 insertions, 1 deletions
diff --git a/graphics/SDL_image/distinfo b/graphics/SDL_image/distinfo
index 52b07d4f779..e3c97d2e2f9 100644
--- a/graphics/SDL_image/distinfo
+++ b/graphics/SDL_image/distinfo
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.11 2009/11/15 21:09:50 wiz Exp $
+$NetBSD: distinfo,v 1.12 2011/01/16 12:51:24 wiz Exp $
SHA1 (SDL_image-1.2.10.tar.gz) = 6bae71fdfd795c3dbf39f6c7c0cf8b212914ef97
RMD160 (SDL_image-1.2.10.tar.gz) = 8133f7f8d488b1c3f69ad80a941289b4508d2901
Size (SDL_image-1.2.10.tar.gz) = 1332906 bytes
+SHA1 (patch-aa) = f11c0cb93c5d6c0a1ca6257b9b2bfb7d1640ff35
diff --git a/graphics/SDL_image/patches/patch-aa b/graphics/SDL_image/patches/patch-aa
new file mode 100644
index 00000000000..067a39ce0c9
--- /dev/null
+++ b/graphics/SDL_image/patches/patch-aa
@@ -0,0 +1,112 @@
+$NetBSD: patch-aa,v 1.3 2011/01/16 12:51:24 wiz Exp $
+
+Fix build with png-1.5.
+
+--- IMG_png.c.orig 2009-11-08 10:55:32.000000000 +0000
++++ IMG_png.c
+@@ -80,6 +80,8 @@ static struct {
+ void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr);
+ png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method);
+ png_voidp (*png_get_io_ptr) (png_structp png_ptr);
++ png_byte (*png_get_channels) (png_structp png_ptr, png_infop info_ptr);
++ png_uint_32 (*png_get_PLTE) (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette);
+ png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values);
+ png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag);
+ void (*png_read_image) (png_structp png_ptr, png_bytepp image);
+@@ -129,6 +131,13 @@ int IMG_InitPNG()
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
++ lib.png_get_channels =
++ (png_byte (*) (png_structp, png_infop))
++ SDL_LoadFunction(lib.handle, "png_get_channels");
++ if ( lib.png_get_channels == NULL ) {
++ SDL_UnloadObject(lib.handle);
++ return -1;
++ }
+ lib.png_get_io_ptr =
+ (png_voidp (*) (png_structp))
+ SDL_LoadFunction(lib.handle, "png_get_io_ptr");
+@@ -136,6 +145,13 @@ int IMG_InitPNG()
+ SDL_UnloadObject(lib.handle);
+ return -1;
+ }
++ lib.png_get_PLTE =
++ (png_uint_32 (*) (png_structp, png_infop, png_colorp *, int *))
++ SDL_LoadFunction(lib.handle, "png_get_PLTE");
++ if ( lib.png_get_PLTE == NULL ) {
++ SDL_UnloadObject(lib.handle);
++ return -1;
++ }
+ lib.png_get_tRNS =
+ (png_uint_32 (*) (png_structp, png_infop, png_bytep *, int *, png_color_16p *))
+ SDL_LoadFunction(lib.handle, "png_get_tRNS");
+@@ -236,7 +252,9 @@ int IMG_InitPNG()
+ lib.png_create_read_struct = png_create_read_struct;
+ lib.png_destroy_read_struct = png_destroy_read_struct;
+ lib.png_get_IHDR = png_get_IHDR;
++ lib.png_get_channels = png_get_channels;
+ lib.png_get_io_ptr = png_get_io_ptr;
++ lib.png_get_PLTE = png_get_PLTE;
+ lib.png_get_tRNS = png_get_tRNS;
+ lib.png_get_valid = png_get_valid;
+ lib.png_read_image = png_read_image;
+@@ -347,7 +365,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)) ) {
+ error = "Error reading the PNG file.";
+ goto done;
+ }
+@@ -416,9 +434,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ Rmask = 0x000000FF;
+ Gmask = 0x0000FF00;
+ Bmask = 0x00FF0000;
+- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
++ Amask = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0;
+ } else {
+- int s = (info_ptr->channels == 4) ? 0 : 8;
++ int s = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
+ Rmask = 0xFF000000 >> s;
+ Gmask = 0x00FF0000 >> s;
+ Bmask = 0x0000FF00 >> s;
+@@ -426,7 +444,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*lib.png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask);
+ if ( surface == NULL ) {
+ error = "Out of memory";
+ goto done;
+@@ -467,6 +485,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *s
+ /* Load the palette, if any */
+ palette = surface->format->palette;
+ if ( palette ) {
++ int png_num_palette;
++ png_colorp png_palette;
++ lib.png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette);
+ if(color_type == PNG_COLOR_TYPE_GRAY) {
+ palette->ncolors = 256;
+ for(i = 0; i < 256; i++) {
+@@ -474,12 +495,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 (png_num_palette > 0 ) {
++ palette->ncolors = png_num_palette;
++ for( i=0; i<png_num_palette; ++i ) {
++ palette->colors[i].b = png_palette[i].blue;
++ palette->colors[i].g = png_palette[i].green;
++ palette->colors[i].r = png_palette[i].red;
+ }
+ }
+ }