Gentoo Archives: gentoo-commits

From: "Samuli Suominen (ssuominen)" <ssuominen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in x11-libs/fltk/files: fltk-1.1.10-libpng15.patch
Date: Fri, 30 Sep 2011 22:12:18
Message-Id: 20110930221148.D00942004C@flycatcher.gentoo.org
1 ssuominen 11/09/30 22:11:48
2
3 Added: fltk-1.1.10-libpng15.patch
4 Log:
5 Fix building with libpng15 wrt #373521 by Stuart Longland
6
7 (Portage version: 2.2.0_alpha59/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 x11-libs/fltk/files/fltk-1.1.10-libpng15.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-libs/fltk/files/fltk-1.1.10-libpng15.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-libs/fltk/files/fltk-1.1.10-libpng15.patch?rev=1.1&content-type=text/plain
14
15 Index: fltk-1.1.10-libpng15.patch
16 ===================================================================
17 --- src/Fl_PNG_Image.cxx
18 +++ src/Fl_PNG_Image.cxx
19 @@ -66,7 +66,8 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
20 png_structp pp; // PNG read pointer
21 png_infop info; // PNG info pointers
22 png_bytep *rows; // PNG row pointers
23 -
24 + png_byte color_type; // PNG color type
25 + png_byte bit_depth; // PNG bit depth
26
27 // Open the PNG file...
28 if ((fp = fopen(png, "rb")) == NULL) return;
29 @@ -75,7 +76,7 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
30 pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
31 info = png_create_info_struct(pp);
32
33 - if (setjmp(pp->jmpbuf))
34 + if (setjmp(png_jmpbuf(pp)))
35 {
36 Fl::warning("PNG file \"%s\" contains errors!\n", png);
37 return;
38 @@ -86,28 +87,24 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
39
40 // Get the image dimensions and convert to grayscale or RGB...
41 png_read_info(pp, info);
42 + color_type = png_get_color_type(pp, info);
43
44 - if (info->color_type == PNG_COLOR_TYPE_PALETTE)
45 + if (color_type == PNG_COLOR_TYPE_PALETTE)
46 png_set_expand(pp);
47
48 - if (info->color_type & PNG_COLOR_MASK_COLOR)
49 - channels = 3;
50 - else
51 - channels = 1;
52 -
53 - if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
54 - channels ++;
55 + channels = png_get_channels(pp, info);
56
57 - w((int)(info->width));
58 - h((int)(info->height));
59 + w((int)(png_get_image_width(pp, info)));
60 + h((int)(png_get_image_height(pp, info)));
61 d(channels);
62
63 - if (info->bit_depth < 8)
64 + bit_depth = png_get_bit_depth(pp, info);
65 + if (bit_depth < 8)
66 {
67 png_set_packing(pp);
68 png_set_expand(pp);
69 }
70 - else if (info->bit_depth == 16)
71 + else if (bit_depth == 16)
72 png_set_strip_16(pp);
73
74 # if defined(HAVE_PNG_GET_VALID) && defined(HAVE_PNG_SET_TRNS_TO_ALPHA)