mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Only check the tRNS (trans) chunk if the image is still palettized
This commit is contained in:
parent
8dcc415202
commit
e746a1ecba
1 changed files with 14 additions and 11 deletions
|
|
@ -909,20 +909,23 @@ static png_bytep *PNG_Read(
|
||||||
|
|
||||||
// If any of the tRNS colors have an alpha lower than 0xFF, and that
|
// If any of the tRNS colors have an alpha lower than 0xFF, and that
|
||||||
// color is present on the image, the palette flag is disabled.
|
// color is present on the image, the palette flag is disabled.
|
||||||
png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values);
|
if (usepal)
|
||||||
|
|
||||||
if (trans && trans_num == 256)
|
|
||||||
{
|
{
|
||||||
int i;
|
png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values);
|
||||||
for (i = 0; i < trans_num; i++)
|
|
||||||
|
if (trans && trans_num == 256)
|
||||||
{
|
{
|
||||||
// libpng will transform this image into RGB even if
|
INT32 i;
|
||||||
// the transparent index does not exist in the image,
|
for (i = 0; i < trans_num; i++)
|
||||||
// and there is no way around that.
|
|
||||||
if (trans[i] < 0xFF)
|
|
||||||
{
|
{
|
||||||
usepal = false;
|
// libpng will transform this image into RGB even if
|
||||||
break;
|
// the transparent index does not exist in the image,
|
||||||
|
// and there is no way around that.
|
||||||
|
if (trans[i] < 0xFF)
|
||||||
|
{
|
||||||
|
usepal = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue