Commit 6a1d49bc authored by Øyvind "pippin" Kolås's avatar Øyvind "pippin" Kolås
Browse files

app: fix legacy divide blend mode

The porting from 8bit per component scaled some 8bit fractions up to huge
floating point numbers, this works for most values but causes trouble for near
transparent pixel values. This commit copies the inner blend loop from the new
divide layer mode, but keeps the old compositing logic.
parent 9128f3fc
......@@ -88,7 +88,15 @@ gimp_operation_divide_legacy_process (GeglOperation *op,
for (b = RED; b < ALPHA; b++)
{
gfloat comp = (4294967296.0 / 4294967295.0 * in[b]) / (1.0 / 4294967295.0 + layer[b]);
gfloat comp = in[b] / layer[b];
/* make infinities(or NaN) correspond to a high number,
* to get more predictable math, ideally higher than 5.0
* but it seems like some babl conversions might be
* acting up then
*/
if (!(comp > -42949672.0f && comp < 5.0f))
comp = 1.0f;
out[b] = comp * ratio + in[b] * (1.0 - ratio);
out[b] = CLAMP (out[b], 0.0, 1.0);
......
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