Commit 7858eb3d authored by Massimo Valentini's avatar Massimo Valentini

Bug 766683: Burn Mode on Paint tools are producing artefacts

This operation produces NAN (0 / 0) and division
by zero when a layer component is zero.

Inline CLAMP to make sure it swallows also NAN.
A NAN is mapped to 1 for backward compatibility.
[the 2variate function comp (in[b], layer[b]) is
discontinuous at layer[b] = 0]
parent a1f01970
......@@ -109,7 +109,10 @@ gimp_operation_burn_mode_process_pixels (gfloat *in,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = 1.0 - (1.0 - in[b]) / layer[b];
comp = CLAMP (comp, 0.0, 1.0);
/* The CLAMP macro is deliberately inlined and
* written to map comp == NAN (0 / 0) -> 1
*/
comp = comp < 0 ? 0.0 : comp < 1.0 ? comp : 1.0;
out[b] = comp * ratio + in[b] * (1.0 - ratio);
}
......
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