[gimp] Bug 766683: Burn Mode on Paint tools are producing artefacts
- From: Massimo Valentini <mvalentini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 766683: Burn Mode on Paint tools are producing artefacts
- Date: Mon, 6 Jun 2016 16:58:55 +0000 (UTC)
commit 7858eb3df2c30e1604ca6cb925551c5b2186df9a
Author: Massimo Valentini <mvalentini src gnome org>
Date: Mon Jun 6 18:47:47 2016 +0200
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]
app/operations/gimpoperationburnmode.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/app/operations/gimpoperationburnmode.c b/app/operations/gimpoperationburnmode.c
index 8822e9d..c4a695e 100644
--- a/app/operations/gimpoperationburnmode.c
+++ b/app/operations/gimpoperationburnmode.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]