Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-libs/libpano13/files: libpano13-2.9.17-libpng-1.5.patch
Date: Tue, 22 Feb 2011 21:03:21
Message-Id: 20110222210311.6C6B320057@flycatcher.gentoo.org
1 vapier 11/02/22 21:03:11
2
3 Added: libpano13-2.9.17-libpng-1.5.patch
4 Log:
5 Add fix from upstream tracker for building with libpng-1.5.
6
7 (Portage version: 2.2.0_alpha24/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 media-libs/libpano13/files/libpano13-2.9.17-libpng-1.5.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/libpano13/files/libpano13-2.9.17-libpng-1.5.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/libpano13/files/libpano13-2.9.17-libpng-1.5.patch?rev=1.1&content-type=text/plain
14
15 Index: libpano13-2.9.17-libpng-1.5.patch
16 ===================================================================
17 https://bugs.launchpad.net/panotools/+bug/719076
18
19 $NetBSD: patch-png.c,v 1.1 2011/02/07 01:03:35 wiz Exp $
20
21 Fix build with png-1.5.
22
23 --- png.c
24 +++ png.c
25 @@ -56,7 +56,7 @@ int writePNG( Image *im, fullPath *sfile
26 }
27
28 /* set error handling */
29 - if (setjmp(png_ptr->jmpbuf))
30 + if (setjmp(png_jmpbuf(png_ptr)))
31 {
32 /* If we get here, we had a problem reading the file */
33 fclose(outfile);
34 @@ -68,14 +68,15 @@ int writePNG( Image *im, fullPath *sfile
35 png_init_io(png_ptr, outfile);
36
37 FourToThreeBPP( im );
38 - info_ptr->width = im->width;
39 - info_ptr->height = im->height;
40 - info_ptr->bit_depth = (im->bitsPerPixel > 32 ? 16 : 8);
41 - info_ptr->color_type = PNG_COLOR_TYPE_RGB;
42 + png_set_IHDR(png_ptr, info_ptr, im->width, im->height,
43 + (im->bitsPerPixel > 32 ? 16 : 8), PNG_COLOR_TYPE_RGB,
44 + 0, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
45 +
46 +#if 0
47 info_ptr->channels = (png_byte)(im->bitsPerPixel / info_ptr->bit_depth);
48 info_ptr->pixel_depth = (png_byte)(im->bitsPerPixel);
49 info_ptr->rowbytes = im->bytesPerLine;
50 - info_ptr->interlace_type= 0;
51 +#endif
52
53 png_write_info(png_ptr, info_ptr);
54
55 @@ -120,6 +121,7 @@ int readPNG ( Image *im, fullPath *sfile
56 png_bytep *row_pointers;
57 int row;
58 unsigned long dataSize;
59 + int color_type;
60
61 #ifdef __Mac__
62 unsigned char the_pcUnixFilePath[256];//added by Kekus Digital
63 @@ -165,7 +167,7 @@ int readPNG ( Image *im, fullPath *sfile
64 }
65
66 /* set error handling if you are using the setjmp/longjmp method */
67 - if (setjmp(png_ptr->jmpbuf))
68 + if (setjmp(png_jmpbuf(png_ptr)))
69 {
70 /* Free all of the memory associated with the png_ptr and info_ptr */
71 png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
72 @@ -182,9 +184,10 @@ int readPNG ( Image *im, fullPath *sfile
73 /* read the file information */
74 png_read_info(png_ptr, info_ptr);
75
76 - if( info_ptr->color_type != PNG_COLOR_TYPE_RGB &&
77 - info_ptr->color_type != PNG_COLOR_TYPE_PALETTE &&
78 - info_ptr->color_type != PNG_COLOR_TYPE_RGB_ALPHA)
79 + color_type = png_get_color_type(png_ptr, info_ptr);
80 + if( color_type != PNG_COLOR_TYPE_RGB &&
81 + color_type != PNG_COLOR_TYPE_PALETTE &&
82 + color_type != PNG_COLOR_TYPE_RGB_ALPHA)
83 {
84 PrintError(" Only rgb images supported");
85 png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
86 @@ -194,24 +197,17 @@ int readPNG ( Image *im, fullPath *sfile
87
88
89 /* expand paletted colors into true RGB triplets */
90 - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
91 + if (color_type == PNG_COLOR_TYPE_PALETTE)
92 png_set_expand(png_ptr);
93
94
95 SetImageDefaults( im );
96
97 - im->width = info_ptr->width;
98 - im->height = info_ptr->height;
99 - im->bytesPerLine = info_ptr->rowbytes;
100 - im->bitsPerPixel = info_ptr->pixel_depth;
101 + im->width = png_get_image_width(png_ptr, info_ptr);
102 + im->height = png_get_image_height(png_ptr, info_ptr);
103 + im->bytesPerLine = png_get_rowbytes(png_ptr, info_ptr);
104 im->dataSize = im->height * im->bytesPerLine;
105 - if( im->bitsPerPixel == 24 )
106 - dataSize = im->width * im->height * 4;
107 - else if( im->bitsPerPixel == 48 )
108 - dataSize = im->width * im->height * 8;
109 - else
110 - dataSize = im->width * im->height * im->bitsPerPixel/8;
111 -
112 + im->bitsPerPixel = 8 * im->bytesPerLine / im->width;
113
114 im->data = (unsigned char**)mymalloc( (dataSize > im->dataSize ? dataSize : im->dataSize) );
115 if( im->data == NULL ){