app: clamp blended results for some compositing ops

Quite probably we shouldn't even clamp at the end, not doing that would speed
up compositing. See bug 744265.
parent 940349c5
......@@ -109,9 +109,9 @@ gimp_operation_burn_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = (1.0 - in[b]) / layer[b];
comp = CLAMP (1.0 - comp, 0.0, 1.0);
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP (1.0 - out[b], 0.0, 1.0);
}
}
else
......
......@@ -109,9 +109,9 @@ gimp_operation_divide_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = (4294967296.0 / 4294967295.0 * in[b]) / (1.0 / 4294967295.0 + layer[b]);
comp = CLAMP (comp, 0.0, 1.0);
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP (out[b], 0.0, 1.0);
}
}
else
......
......@@ -109,9 +109,9 @@ gimp_operation_grain_extract_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = in[b] - layer[b] + 0.5;
comp = CLAMP (comp, 0.0, 1.0);
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP (out[b], 0.0, 1.0);
}
}
else
......
......@@ -109,9 +109,9 @@ gimp_operation_grain_merge_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = in[b] + layer[b] - 0.5;
comp = CLAMP (comp, 0.0, 1.0);
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP (out[b], 0.0, 1.0);
}
}
else
......
......@@ -109,9 +109,8 @@ gimp_operation_multiply_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = layer[b] * in[b];
comp = CLAMP (comp, 0.0, 1.0);
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP (out[b], 0.0, 1.0);
}
}
else
......
......@@ -109,9 +109,8 @@ gimp_operation_subtract_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = in[b] - layer[b];
comp = (comp < 0) ? 0 : comp;
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP(out[b], 0.0, 1.0);
}
}
else
......
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