app: small optimization in gimp_operation_normal_mode_process()

Move some calculations out of the R,G,B loop, including a floating
point division, now there is only one division left per pixel.
This commit is contained in:
Michael Natterer
2013-04-28 23:32:49 +02:00
parent 6e332505ca
commit 77d1b49edc

View File

@ -176,11 +176,13 @@ gimp_operation_normal_mode_process (GeglOperation *operation,
if (out[ALPHA])
{
gint b;
gfloat in_weight = in[ALPHA] * (1.0f - aux_alpha);
gfloat recip_out_alpha = 1.0f / out[ALPHA];
gint b;
for (b = RED; b < ALPHA; b++)
{
out[b] = (aux[b] * aux_alpha + in[b] * in[ALPHA] * (1.0f - aux_alpha)) / out[ALPHA];
out[b] = (aux[b] * aux_alpha + in[b] * in_weight) * recip_out_alpha;
}
}
else