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.
This commit is contained in:
@ -109,9 +109,9 @@ gimp_operation_burn_mode_process_pixels (gfloat *in,
|
|||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
{
|
||||||
gfloat comp = (1.0 - in[b]) / layer[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] = comp * ratio + in[b] * (1.0 - ratio);
|
||||||
|
out[b] = CLAMP (1.0 - out[b], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -109,9 +109,9 @@ gimp_operation_divide_mode_process_pixels (gfloat *in,
|
|||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
{
|
||||||
gfloat comp = (4294967296.0 / 4294967295.0 * in[b]) / (1.0 / 4294967295.0 + layer[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] = comp * ratio + in[b] * (1.0 - ratio);
|
||||||
|
out[b] = CLAMP (out[b], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -109,9 +109,9 @@ gimp_operation_grain_extract_mode_process_pixels (gfloat *in,
|
|||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
{
|
||||||
gfloat comp = in[b] - layer[b] + 0.5;
|
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] = comp * ratio + in[b] * (1.0 - ratio);
|
||||||
|
out[b] = CLAMP (out[b], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -109,9 +109,9 @@ gimp_operation_grain_merge_mode_process_pixels (gfloat *in,
|
|||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
{
|
||||||
gfloat comp = in[b] + layer[b] - 0.5;
|
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] = comp * ratio + in[b] * (1.0 - ratio);
|
||||||
|
out[b] = CLAMP (out[b], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -109,9 +109,8 @@ gimp_operation_multiply_mode_process_pixels (gfloat *in,
|
|||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
{
|
||||||
gfloat comp = layer[b] * in[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] = comp * ratio + in[b] * (1.0 - ratio);
|
||||||
|
out[b] = CLAMP (out[b], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -109,9 +109,8 @@ gimp_operation_subtract_mode_process_pixels (gfloat *in,
|
|||||||
for (b = RED; b < ALPHA; b++)
|
for (b = RED; b < ALPHA; b++)
|
||||||
{
|
{
|
||||||
gfloat comp = in[b] - layer[b];
|
gfloat comp = in[b] - layer[b];
|
||||||
comp = (comp < 0) ? 0 : comp;
|
|
||||||
|
|
||||||
out[b] = comp * ratio + in[b] * (1.0 - ratio);
|
out[b] = comp * ratio + in[b] * (1.0 - ratio);
|
||||||
|
out[b] = CLAMP(out[b], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user