mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Exit loop over tRNS array once a transparent pixel is found
(performance report by PoChun Chang).
This commit is contained in:
parent
394bc6cdee
commit
79fc8fa0d9
@ -1357,12 +1357,18 @@ png_init_palette_transformations(png_structrp png_ptr)
|
|||||||
|
|
||||||
/* Ignore if all the entries are opaque (unlikely!) */
|
/* Ignore if all the entries are opaque (unlikely!) */
|
||||||
for (i=0; i<png_ptr->num_trans; ++i)
|
for (i=0; i<png_ptr->num_trans; ++i)
|
||||||
|
{
|
||||||
if (png_ptr->trans_alpha[i] == 255)
|
if (png_ptr->trans_alpha[i] == 255)
|
||||||
continue;
|
continue;
|
||||||
else if (png_ptr->trans_alpha[i] == 0)
|
else if (png_ptr->trans_alpha[i] == 0)
|
||||||
input_has_transparency = 1;
|
input_has_transparency = 1;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
input_has_transparency = 1;
|
||||||
input_has_alpha = 1;
|
input_has_alpha = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If no alpha we can optimize. */
|
/* If no alpha we can optimize. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user