aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-02-15 08:37:44 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-02-15 08:37:44 +0000
commit7a262b425ef270ff2a106b5e4a23759eab9d284f (patch)
tree9f30a494b24f77b73d172d8ce4c2e3ceb78f8e94 /code
parent0e5c2b208a232a5113a33ebfed940e930d32fa9a (diff)
downloadioquake3-aero-7a262b425ef270ff2a106b5e4a23759eab9d284f.tar.gz
ioquake3-aero-7a262b425ef270ff2a106b5e4a23759eab9d284f.zip
png fixes by Joerg Dietrich
git-svn-id: svn://svn.icculus.org/quake3/trunk@1264 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/renderer/tr_image_png.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/code/renderer/tr_image_png.c b/code/renderer/tr_image_png.c
index 0691408..e33ffff 100644
--- a/code/renderer/tr_image_png.c
+++ b/code/renderer/tr_image_png.c
@@ -832,9 +832,6 @@ static qboolean UnfilterImage(uint8_t *DecompressedData,
/*
* input verification
- *
- * ImageHeight and BytesPerScanline are not checked,
- * because these can be zero in some interlace passes.
*/
if(!(DecompressedData && BytesPerPixel))
@@ -842,6 +839,14 @@ static qboolean UnfilterImage(uint8_t *DecompressedData,
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 @@ static qboolean ConvertPixel(struct PNG_Chunk_IHDR *IHDR,
{
if((TransparentColour[1] == DecompPtr[0]) &&
(TransparentColour[3] == DecompPtr[1]) &&
- (TransparentColour[5] == DecompPtr[3]))
+ (TransparentColour[5] == DecompPtr[2]))
{
OutPtr[3] = 0x00;
}
@@ -1828,9 +1833,13 @@ static qboolean DecodeImageInterlaced(struct PNG_Chunk_IHDR *IHDR,
/*
* skip FilterType
+ * but only when the pass has a width bigger than zero
*/
- DecompPtr++;
+ if(BytesPerScanline[a])
+ {
+ DecompPtr++;
+ }
/*
* Reset the pixel count.