r1264 - trunk/code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Feb 15 03:38:10 EST 2008


Author: ludwig
Date: 2008-02-15 03:37:44 -0500 (Fri, 15 Feb 2008)
New Revision: 1264

Modified:
   trunk/code/renderer/tr_image_png.c
Log:
png fixes by Joerg Dietrich


Modified: trunk/code/renderer/tr_image_png.c
===================================================================
--- trunk/code/renderer/tr_image_png.c	2008-02-14 20:30:51 UTC (rev 1263)
+++ trunk/code/renderer/tr_image_png.c	2008-02-15 08:37:44 UTC (rev 1264)
@@ -832,9 +832,6 @@
 
 	/*
 	 *  input verification
-	 *
-	 *  ImageHeight and BytesPerScanline are not checked,
-	 *  because these can be zero in some interlace passes.
 	 */
 
 	if(!(DecompressedData && BytesPerPixel))
@@ -842,7 +839,15 @@
 		return(qfalse);
 	}
 
+	/*
+	 *  ImageHeight and BytesPerScanline can be zero in small interlaced images.
+	 */
 
+	if((!ImageHeight) || (!BytesPerScanline))
+	{
+		return(qtrue);
+	}
+
 	/*
 	 *  Set the pointer to the start of the decompressed Data.
 	 */
@@ -1101,7 +1106,7 @@
 					{
 						if((TransparentColour[1] == DecompPtr[0]) &&
 								(TransparentColour[3] == DecompPtr[1]) &&
-								(TransparentColour[5] == DecompPtr[3]))
+								(TransparentColour[5] == DecompPtr[2]))
 						{
 							OutPtr[3] = 0x00;
 						}
@@ -1828,9 +1833,13 @@
 
 			/*
 			 *  skip FilterType
+			 *  but only when the pass has a width bigger than zero
 			 */
 
-			DecompPtr++;
+			if(BytesPerScanline[a])
+			{
+				DecompPtr++;
+			}
 
 			/*
 			 *  Reset the pixel count.




More information about the quake3-commits mailing list