Skip to content
Snippets Groups Projects
Commit 59e1706f authored by Tatsuru's avatar Tatsuru
Browse files

Merge branch 'png-trans-fix' into 'next'

Fix issue with png_get_tRNS

See merge request STJr/SRB2!1606
parents 7a53b242 3ff8d9d3
No related branches found
No related tags found
No related merge requests found
...@@ -901,9 +901,8 @@ static png_bytep *PNG_Read( ...@@ -901,9 +901,8 @@ static png_bytep *PNG_Read(
png_colorp palette; png_colorp palette;
int palette_size; int palette_size;
png_bytep trans; png_bytep trans = NULL;
int trans_num; int num_trans = 0;
png_color_16p trans_values;
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
...@@ -998,12 +997,12 @@ static png_bytep *PNG_Read( ...@@ -998,12 +997,12 @@ static png_bytep *PNG_Read(
// color is present on the image, the palette flag is disabled. // color is present on the image, the palette flag is disabled.
if (usepal) if (usepal)
{ {
png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values); png_uint_32 result = png_get_tRNS(png_ptr, png_info_ptr, &trans, &num_trans, NULL);
if (trans && trans_num > 0) if ((result & PNG_INFO_tRNS) && num_trans > 0 && trans != NULL)
{ {
INT32 i; INT32 i;
for (i = 0; i < trans_num; i++) for (i = 0; i < num_trans; i++)
{ {
// libpng will transform this image into RGBA even if // libpng will transform this image into RGBA even if
// the transparent index does not exist in the image, // the transparent index does not exist in the image,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment