Control: tags 741901 + patch

Dear maintainer,

I've prepared the attached patch for the libpng transition.
However, I currently can only provide the patch but not test it,
especially the "write png" part.

Therefore any feedback is appreciated.

-- 
Tobi

Regards.
diff -Nru antigrav-0.0.3/debian/changelog antigrav-0.0.3/debian/changelog
--- antigrav-0.0.3/debian/changelog     2014-09-02 22:51:53.000000000 +0200
+++ antigrav-0.0.3/debian/changelog     2016-01-19 08:02:38.000000000 +0100
@@ -1,3 +1,10 @@
+antigrav (0.0.3-6.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix for libpng16 (Closes: #741901)
+
+ -- Tobias Frost <t...@debian.org>  Tue, 19 Jan 2016 08:01:54 +0100
+
 antigrav (0.0.3-6) unstable; urgency=low
 
   [ Evgeni Golov ]
diff -Nru antigrav-0.0.3/debian/patches/06-libpng16.patch 
antigrav-0.0.3/debian/patches/06-libpng16.patch
--- antigrav-0.0.3/debian/patches/06-libpng16.patch     1970-01-01 
01:00:00.000000000 +0100
+++ antigrav-0.0.3/debian/patches/06-libpng16.patch     2016-01-19 
09:35:18.000000000 +0100
@@ -0,0 +1,90 @@
+Description: Patch for libpng1.6 API change
+Author: Tobias Frost <t...@debian.org>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741901
+Last-Update: 2016-01-19
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/m3dtexture.cpp
++++ b/src/m3dtexture.cpp
+@@ -249,7 +249,7 @@
+               return -1;
+       }
+ 
+-      if(setjmp(pngPtr->jmpbuf))
++      if(setjmp(png_jmpbuf(pngPtr)))
+       {
+               perror("setjmp");
+               png_destroy_read_struct(&pngPtr, &pngInfoPtr, NULL);
+@@ -274,7 +274,7 @@
+               ckey = 0;
+       }
+       
+-      if(colorType != PNG_COLOR_TYPE_RGB_ALPHA || bitDepth != 8 || 
pngInfoPtr->channels != 4)
++      if(colorType != PNG_COLOR_TYPE_RGB_ALPHA || bitDepth != 8 || 
png_get_channels(pngPtr, pngInfoPtr) != 4)
+       {
+               fprintf(stderr, "Only 32-bit RGBA png images are supported\n");
+               return -1;
+@@ -283,7 +283,7 @@
+       png_read_update_info(pngPtr, pngInfoPtr);
+       png_get_IHDR(pngPtr, pngInfoPtr, width, height, &bitDepth, &colorType, 
&interlaceType, NULL, NULL);
+       
+-      (*data) = new unsigned char[(*width) * (*height) * 
pngInfoPtr->channels];
++      (*data) = new unsigned char[(*width) * (*height) * 
png_get_channels(pngPtr, pngInfoPtr)];
+       if((*data) == NULL)
+       {
+               fprintf(stderr, "loadPng(): Out of memory !\n");
+@@ -304,7 +304,7 @@
+ 
+       for(row = 0; (unsigned int) row < (*height); row++)
+       {
+-              rowPointers[row] = (png_bytep)*data + (row * (*width) * 
pngInfoPtr->channels);
++              rowPointers[row] = (png_bytep)*data + (row * (*width) * 
png_get_channels(pngPtr, pngInfoPtr));
+       }
+       png_read_image(pngPtr, rowPointers);
+       png_read_end(pngPtr, pngInfoPtr);
+@@ -358,26 +358,30 @@
+       pngInfoPtr = png_create_info_struct(pngPtr);
+       png_set_write_fn(pngPtr, handle, pngWriteCallback, pngFlushCallback);
+ 
+-      pngInfoPtr->width = width;
+-      pngInfoPtr->height = height;
+-      pngInfoPtr->rowbytes = width * 4;
+-      pngInfoPtr->bit_depth = 8;
+-      pngInfoPtr->interlace_type = 0;
+-      pngInfoPtr->num_palette = 0;
+-      pngInfoPtr->valid = 0;
+-
+-      pngInfoPtr->sig_bit.red = 8;
+-      pngInfoPtr->sig_bit.green = 8;
+-      pngInfoPtr->sig_bit.blue = 8;
+-      pngInfoPtr->sig_bit.alpha = 8;
++      // pngInfoPtr->width = width;
++      // pngInfoPtr->height = height;
++      // likely done by the lib now pngInfoPtr->rowbytes = width * 4;
++      // pngInfoPtr->bit_depth = 8;
++      // pngInfoPtr->interlace_type = 0;
++      // pngInfoPtr->num_palette = 0;
++      // pngInfoPtr->valid = 0;
++
++      png_set_IHDR(pngPtr, pngInfoPtr, width, height, 8,
++          PNG_COLOR_TYPE_RGB_ALPHA, 0, PNG_COMPRESSION_TYPE_DEFAULT,
++          PNG_FILTER_TYPE_DEFAULT);
++
++      // pngInfoPtr->sig_bit.red = 8;
++      // pngInfoPtr->sig_bit.green = 8;
++      // pngInfoPtr->sig_bit.blue = 8;
++      // pngInfoPtr->sig_bit.alpha = 8;
+ 
+-      pngInfoPtr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
++      // pngInfoPtr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
+ 
+       png_write_info(pngPtr, pngInfoPtr);
+ 
+-      rowPointers = new png_bytep[pngInfoPtr->height];
++      rowPointers = new png_bytep[png_get_image_height(pngPtr, pngInfoPtr)];
+ 
+-      for(i = 0; (unsigned int) i < pngInfoPtr->height; i++)
++      for(i = 0; (unsigned int) i < png_get_image_height(pngPtr, pngInfoPtr); 
i++)
+       {
+               rowPointers[i] = (unsigned char*)data + i * width * 4;
+       }
diff -Nru antigrav-0.0.3/debian/patches/series 
antigrav-0.0.3/debian/patches/series
--- antigrav-0.0.3/debian/patches/series        2014-09-02 22:37:46.000000000 
+0200
+++ antigrav-0.0.3/debian/patches/series        2016-01-19 08:03:06.000000000 
+0100
@@ -3,3 +3,4 @@
 02_fix_sound.diff
 03_daca_fixes.diff
 05-use-sys-tinyxml.diff
+06-libpng16.patch

Reply via email to