[libpng17] Exit loop over tRNS array once a transparent pixel is found

(performance report by PoChun Chang).
This commit is contained in:
Glenn Randers-Pehrson 2013-08-04 14:05:39 -05:00
parent 394bc6cdee
commit 79fc8fa0d9

View File

@ -1357,12 +1357,18 @@ png_init_palette_transformations(png_structrp png_ptr)
/* Ignore if all the entries are opaque (unlikely!) */
for (i=0; i<png_ptr->num_trans; ++i)
{
if (png_ptr->trans_alpha[i] == 255)
continue;
else if (png_ptr->trans_alpha[i] == 0)
input_has_transparency = 1;
else
{
input_has_transparency = 1;
input_has_alpha = 1;
break;
}
}
}
/* If no alpha we can optimize. */