/[gentoo-x86]/games-engines/stratagus/files/stratagus-2.2.5.5-libpng15.patch
Gentoo

Contents of /games-engines/stratagus/files/stratagus-2.2.5.5-libpng15.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat Sep 17 16:50:03 2011 UTC (3 years, 3 months ago) by ssuominen
Branch: MAIN
CVS Tags: HEAD
Fix building with libpng15 wrt #383197 by Diego Elio Pettenò

(Portage version: 2.2.0_alpha55/cvs/Linux x86_64)

1 --- src/video/png.cpp
2 +++ src/video/png.cpp
3 @@ -147,7 +147,7 @@
4 * the normal method of doing things with libpng). REQUIRED unless you
5 * set up your own error handlers in png_create_read_struct() earlier.
6 */
7 - if (setjmp(png_ptr->jmpbuf)) {
8 + if (setjmp(png_jmpbuf(png_ptr))) {
9 fprintf(stderr, "Error reading the PNG file.\n");
10 ret = -1;
11 goto done;
12 @@ -227,11 +227,11 @@
13 Rmask = 0x000000FF;
14 Gmask = 0x0000FF00;
15 Bmask = 0x00FF0000;
16 - Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
17 + Amask = (png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0;
18 } else {
19 int s;
20
21 - s = (info_ptr->channels == 4) ? 0 : 8;
22 + s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
23 Rmask = 0xFF000000 >> s;
24 Gmask = 0x00FF0000 >> s;
25 Bmask = 0x0000FF00 >> s;
26 @@ -239,7 +239,7 @@
27 }
28 }
29 surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
30 - bit_depth * info_ptr->channels, Rmask, Gmask, Bmask, Amask);
31 + bit_depth * png_get_channels(png_ptr, info_ptr), Rmask, Gmask, Bmask, Amask);
32 if (surface == NULL) {
33 fprintf(stderr, "Out of memory");
34 goto done;
35 @@ -276,6 +276,8 @@
36 png_read_end(png_ptr, info_ptr);
37
38 /* Load the palette, if any */
39 + int png_num_palette;
40 + png_colorp png_palette;
41 palette = surface->format->palette;
42 if (palette) {
43 if (color_type == PNG_COLOR_TYPE_GRAY) {
44 @@ -285,12 +287,12 @@
45 palette->colors[i].g = i;
46 palette->colors[i].b = i;
47 }
48 - } else if (info_ptr->num_palette > 0) {
49 - palette->ncolors = info_ptr->num_palette;
50 - for (i = 0; i < info_ptr->num_palette; ++i) {
51 - palette->colors[i].b = info_ptr->palette[i].blue;
52 - palette->colors[i].g = info_ptr->palette[i].green;
53 - palette->colors[i].r = info_ptr->palette[i].red;
54 + } else if (png_num_palette > 0) {
55 + palette->ncolors = png_num_palette;
56 + for (i = 0; i < png_num_palette; ++i) {
57 + palette->colors[i].b = png_palette[i].blue;
58 + palette->colors[i].g = png_palette[i].green;
59 + palette->colors[i].r = png_palette[i].red;
60 }
61 }
62 }
63 @@ -343,7 +345,7 @@
64 return;
65 }
66
67 - if (setjmp(png_ptr->jmpbuf)) {
68 + if (setjmp(png_jmpbuf(png_ptr))) {
69 /* If we get here, we had a problem reading the file */
70 fclose(fp);
71 png_destroy_write_struct(&png_ptr, &info_ptr);

  ViewVC Help
Powered by ViewVC 1.1.20