mirror of
https://github.com/UberGames/ioef.git
synced 2025-02-17 17:31:08 +00:00
png fixes by Joerg Dietrich
This commit is contained in:
parent
14fda56059
commit
c0f7c8d9cd
1 changed files with 14 additions and 5 deletions
|
@ -832,9 +832,6 @@ static qboolean UnfilterImage(uint8_t *DecompressedData,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* input verification
|
* input verification
|
||||||
*
|
|
||||||
* ImageHeight and BytesPerScanline are not checked,
|
|
||||||
* because these can be zero in some interlace passes.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!(DecompressedData && BytesPerPixel))
|
if(!(DecompressedData && BytesPerPixel))
|
||||||
|
@ -842,6 +839,14 @@ static qboolean UnfilterImage(uint8_t *DecompressedData,
|
||||||
return(qfalse);
|
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.
|
* 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]) &&
|
if((TransparentColour[1] == DecompPtr[0]) &&
|
||||||
(TransparentColour[3] == DecompPtr[1]) &&
|
(TransparentColour[3] == DecompPtr[1]) &&
|
||||||
(TransparentColour[5] == DecompPtr[3]))
|
(TransparentColour[5] == DecompPtr[2]))
|
||||||
{
|
{
|
||||||
OutPtr[3] = 0x00;
|
OutPtr[3] = 0x00;
|
||||||
}
|
}
|
||||||
|
@ -1828,9 +1833,13 @@ static qboolean DecodeImageInterlaced(struct PNG_Chunk_IHDR *IHDR,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* skip FilterType
|
* skip FilterType
|
||||||
|
* but only when the pass has a width bigger than zero
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DecompPtr++;
|
if(BytesPerScanline[a])
|
||||||
|
{
|
||||||
|
DecompPtr++;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset the pixel count.
|
* Reset the pixel count.
|
||||||
|
|
Loading…
Reference in a new issue