cvs: gd /libgd/src gd_tiff.c

[email protected] ("Pierre-Alain Joye") Thu, 04 Oct 2007 19:47:00 -0000
Newsgroups php.gd.cvs
Message-ID <cvspajoye1191527220@cvsserver>
pajoye		Thu Oct  4 19:47:00 2007 UTC

  Modified files:              
    /gd/libgd/src	gd_tiff.c 
  Log:
  - fix 32bit read support, inverted vertically
  
  
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_tiff.c?r1=1.1&r2=1.2&diff_format=u
Index: gd/libgd/src/gd_tiff.c
diff -u gd/libgd/src/gd_tiff.c:1.1 gd/libgd/src/gd_tiff.c:1.2
--- gd/libgd/src/gd_tiff.c:1.1	Thu Oct  4 18:53:57 2007
+++ gd/libgd/src/gd_tiff.c	Thu Oct  4 19:47:00 2007
@@ -1,5 +1,3 @@
-
-
 /*
    TIFF - Tagged Image File Format Encapsulation for GD Library
 
@@ -27,6 +25,7 @@
 
    ----------------------------------------------------------------------------
  */
+/* $Id: gd_tiff.c,v 1.2 2007/10/04 19:47:00 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -520,7 +519,7 @@
   else
   {
     /* image is not tiled - assume stripped (scanline) format */
-/*    printf("is a 1bit scanline tiff!\n");*/
+    printf("is a 1bit scanline tiff!\n");
     scan=malloc(TIFFScanlineSize(tiff));
     y=0;
     x=0;
@@ -607,7 +606,7 @@
 
   if(TIFFIsTiled(tiff))
   {
-/*    printf("is a 8bit tiled tiff! (%d tiles)\n",numberOfTiles);*/
+    printf("is a 8bit tiled tiff! (%d tiles)\n",numberOfTiles);
     TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tileMaxX);
     TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tileMaxY);
 
@@ -719,6 +718,8 @@
   uint32 *scan;
   uint32 rgba;
 
+	printf("32 bits\n");
+
   if(!(im=gdImageCreateTrueColor(width,height)))
   {
     TIFFClose(tiff);
@@ -731,9 +732,6 @@
   alphaBlendingFlag=im->alphaBlendingFlag;
   gdImageAlphaBlending(im,0);
 
-  /* Make sure new image begins completely black */
-  gdImageColorAllocateAlpha(im, 0, 0, 0, 0x0);
-
   /* loop through y-coords, and x-coords */
   scan=calloc(sizeof(uint32),width*height);
   TIFFReadRGBAImage(tiff,width,height,scan,0);
@@ -749,10 +747,10 @@
       g=TIFFGetG(rgba);
       r=TIFFGetR(rgba);
 
-      colour=gdImageColorResolveAlpha(im,r,g,b,a);
+      colour=gdTrueColorAlpha(r,g,b,a);
 
       /* set pixel colour to this colour */
-      gdImageSetPixel(im,x,y,colour);
+      gdImageSetPixel(im, x, height - y - 1,colour);
     }
   }
   free(scan);