Commit 3a43478f authored by Massimo Valentini's avatar Massimo Valentini

Bug 766116: Behind mode is not working correctly

use same var names as gimp-2-8 to make
it easier to spot unwanted differences
parent d41e362b
......@@ -93,29 +93,36 @@ gimp_operation_behind_mode_process_pixels (gfloat *in,
while (samples--)
{
gfloat value = opacity;
gfloat src1_alpha = in[ALPHA];
gfloat src2_alpha = layer[ALPHA] * opacity;
gfloat new_alpha;
gint b;
if (has_mask)
value *= *mask;
src2_alpha *= *mask;
out[ALPHA] = in[ALPHA] + (1.0 - in[ALPHA]) * layer[ALPHA] * value;
new_alpha = src2_alpha + (1.0 - src2_alpha) * src1_alpha;
if (out[ALPHA])
if (new_alpha)
{
gfloat ratio = in[ALPHA] / new_alpha;
gfloat compl_ratio = 1.0f - ratio;
for (b = RED; b < ALPHA; b++)
{
out[b] = (in[b] * in[ALPHA] + layer[b] * value * layer[ALPHA] * value * (1.0 - in[ALPHA])) / out[ALPHA];
out[b] = in[b] * ratio + layer[b] * compl_ratio;
}
}
else
{
for (b = RED; b <= ALPHA; b++)
for (b = RED; b < ALPHA; b++)
{
out[b] = in[b];
out[b] = layer[b];
}
}
out[ALPHA] = new_alpha;
in += 4;
layer += 4;
out += 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment