[stratagus] Forgot to add the patch file
Bruno Wolff III
bruno at fedoraproject.org
Fri Jul 27 21:01:35 UTC 2012
commit 675b67e7e04735b96346a354fa4d67c6e38506ba
Author: Bruno Wolff III <bruno at wolff.to>
Date: Fri Jul 27 16:01:06 2012 -0500
Forgot to add the patch file
stratagus-libpng15.patch | 75 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/stratagus-libpng15.patch b/stratagus-libpng15.patch
new file mode 100644
index 0000000..e21d04c
--- /dev/null
+++ b/stratagus-libpng15.patch
@@ -0,0 +1,75 @@
+--- src/video/png.cpp.orig 2012-07-27 15:07:23.318579973 -0500
++++ src/video/png.cpp 2012-07-27 15:39:46.054491715 -0500
+@@ -103,7 +103,8 @@
+ png_color_16 *transv;
+ char name[PATH_MAX];
+ int ret;
+-
++ png_color *png_palette;
++ int png_num_palette;
+ ckey = -1;
+ ret = 0;
+
+@@ -146,7 +147,7 @@
+ * 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))) {
+ fprintf(stderr, "Error reading the PNG file.\n");
+ ret = -1;
+ goto done;
+@@ -226,11 +227,11 @@
+ Rmask = 0x000000FF;
+ Gmask = 0x0000FF00;
+ Bmask = 0x00FF0000;
+- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
++ Amask = (png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0;
+ } else {
+ int s;
+
+- s = (info_ptr->channels == 4) ? 0 : 8;
++ s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
+ Rmask = 0xFF000000 >> s;
+ Gmask = 0x00FF0000 >> s;
+ Bmask = 0x0000FF00 >> s;
+@@ -238,7 +239,7 @@
+ }
+ }
+ surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
+- bit_depth * info_ptr->channels, Rmask, Gmask, Bmask, Amask);
++ png_get_bit_depth(png_ptr, info_ptr) * png_get_channels(png_ptr, info_ptr), Rmask, Gmask, Bmask, Amask);
+ if (surface == NULL) {
+ fprintf(stderr, "Out of memory");
+ goto done;
+@@ -284,12 +285,15 @@
+ 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 {
++ png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette);
++ 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;
++ }
+ }
+ }
+ }
+@@ -343,7 +347,7 @@
+ return;
+ }
+
+- if (setjmp(png_ptr->jmpbuf)) {
++ if (setjmp(png_jmpbuf(png_ptr))) {
+ /* If we get here, we had a problem reading the file */
+ fclose(fp);
+ png_destroy_write_struct(&png_ptr, &info_ptr);
More information about the scm-commits
mailing list