diff options
author | wiz <wiz> | 2011-02-07 01:03:35 +0000 |
---|---|---|
committer | wiz <wiz> | 2011-02-07 01:03:35 +0000 |
commit | fcd63e0b881bf77f2dc006246aba22a29c22cb76 (patch) | |
tree | b1d0370ead46cc78ef5f259bb52f34c7d392be58 /graphics/libpano13 | |
parent | ee78cdcabf3018f302674d5bc8fff9782ae3bb2f (diff) | |
download | pkgsrc-fcd63e0b881bf77f2dc006246aba22a29c22cb76.tar.gz |
Fix build with png-1.5.
Diffstat (limited to 'graphics/libpano13')
-rw-r--r-- | graphics/libpano13/distinfo | 3 | ||||
-rw-r--r-- | graphics/libpano13/patches/patch-png.c | 97 |
2 files changed, 99 insertions, 1 deletions
diff --git a/graphics/libpano13/distinfo b/graphics/libpano13/distinfo index ff9fb95ef9f..4708e11ce35 100644 --- a/graphics/libpano13/distinfo +++ b/graphics/libpano13/distinfo @@ -1,6 +1,7 @@ -$NetBSD: distinfo,v 1.2 2010/09/15 10:13:26 adam Exp $ +$NetBSD: distinfo,v 1.3 2011/02/07 01:03:35 wiz Exp $ SHA1 (libpano13-2.9.17.tar.gz) = 418689985ea622bc234cd4eccec42180c12821b2 RMD160 (libpano13-2.9.17.tar.gz) = 3a54295bfadbbd32009a8628968c723c7017f2df Size (libpano13-2.9.17.tar.gz) = 2735157 bytes SHA1 (patch-aa) = 021c84a642170c26f075f4bb5deba2bc2875fdc9 +SHA1 (patch-png.c) = 93c3bc1a4b7358e9ff786569e68e308ad73bd8e4 diff --git a/graphics/libpano13/patches/patch-png.c b/graphics/libpano13/patches/patch-png.c new file mode 100644 index 00000000000..80fb2ad809d --- /dev/null +++ b/graphics/libpano13/patches/patch-png.c @@ -0,0 +1,97 @@ +$NetBSD: patch-png.c,v 1.1 2011/02/07 01:03:35 wiz Exp $ + +Fix build with png-1.5. + +--- png.c.orig 2008-01-02 14:46:28.000000000 +0000 ++++ png.c +@@ -56,7 +56,7 @@ int writePNG( Image *im, fullPath *sfile + } + + /* set error handling */ +- if (setjmp(png_ptr->jmpbuf)) ++ if (setjmp(png_jmpbuf(png_ptr))) + { + /* If we get here, we had a problem reading the file */ + fclose(outfile); +@@ -68,14 +68,15 @@ int writePNG( Image *im, fullPath *sfile + png_init_io(png_ptr, outfile); + + FourToThreeBPP( im ); +- info_ptr->width = im->width; +- info_ptr->height = im->height; +- info_ptr->bit_depth = (im->bitsPerPixel > 32 ? 16 : 8); +- info_ptr->color_type = PNG_COLOR_TYPE_RGB; ++ png_set_IHDR(png_ptr, info_ptr, im->width, im->height, ++ (im->bitsPerPixel > 32 ? 16 : 8), PNG_COLOR_TYPE_RGB, ++ 0, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); ++ ++#if 0 + info_ptr->channels = (png_byte)(im->bitsPerPixel / info_ptr->bit_depth); + info_ptr->pixel_depth = (png_byte)(im->bitsPerPixel); + info_ptr->rowbytes = im->bytesPerLine; +- info_ptr->interlace_type= 0; ++#endif + + png_write_info(png_ptr, info_ptr); + +@@ -120,6 +121,7 @@ int readPNG ( Image *im, fullPath *sfile + png_bytep *row_pointers; + int row; + unsigned long dataSize; ++ int color_type; + + #ifdef __Mac__ + unsigned char the_pcUnixFilePath[256];//added by Kekus Digital +@@ -165,7 +167,7 @@ int readPNG ( Image *im, fullPath *sfile + } + + /* set error handling if you are using the setjmp/longjmp method */ +- if (setjmp(png_ptr->jmpbuf)) ++ if (setjmp(png_jmpbuf(png_ptr))) + { + /* Free all of the memory associated with the png_ptr and info_ptr */ + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); +@@ -182,9 +184,10 @@ int readPNG ( Image *im, fullPath *sfile + /* read the file information */ + png_read_info(png_ptr, info_ptr); + +- if( info_ptr->color_type != PNG_COLOR_TYPE_RGB && +- info_ptr->color_type != PNG_COLOR_TYPE_PALETTE && +- info_ptr->color_type != PNG_COLOR_TYPE_RGB_ALPHA) ++ color_type = png_get_color_type(png_ptr, info_ptr); ++ if( color_type != PNG_COLOR_TYPE_RGB && ++ color_type != PNG_COLOR_TYPE_PALETTE && ++ color_type != PNG_COLOR_TYPE_RGB_ALPHA) + { + PrintError(" Only rgb images supported"); + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); +@@ -194,24 +197,17 @@ int readPNG ( Image *im, fullPath *sfile + + + /* expand paletted colors into true RGB triplets */ +- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ++ if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_expand(png_ptr); + + + SetImageDefaults( im ); + +- im->width = info_ptr->width; +- im->height = info_ptr->height; +- im->bytesPerLine = info_ptr->rowbytes; +- im->bitsPerPixel = info_ptr->pixel_depth; ++ im->width = png_get_image_width(png_ptr, info_ptr); ++ im->height = png_get_image_height(png_ptr, info_ptr); ++ im->bytesPerLine = png_get_rowbytes(png_ptr, info_ptr); + im->dataSize = im->height * im->bytesPerLine; +- if( im->bitsPerPixel == 24 ) +- dataSize = im->width * im->height * 4; +- else if( im->bitsPerPixel == 48 ) +- dataSize = im->width * im->height * 8; +- else +- dataSize = im->width * im->height * im->bitsPerPixel/8; +- ++ im->bitsPerPixel = 8 * im->bytesPerLine / im->width; + + im->data = (unsigned char**)mymalloc( (dataSize > im->dataSize ? dataSize : im->dataSize) ); + if( im->data == NULL ){ |