[gimp] Bug 781804 - Dodge/Burn tool produces artifacts with negative channel values
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 781804 - Dodge/Burn tool produces artifacts with negative channel values
- Date: Thu, 27 Apr 2017 01:33:08 +0000 (UTC)
commit e0dcf538e5381fa6349036d43f02fafd52d87cb3
Author: Ell <ell_se yahoo com>
Date: Wed Apr 26 21:25:51 2017 -0400
Bug 781804 - Dodge/Burn tool produces artifacts with negative channel values
The halftones transfer mode of dodge/burn uses pow(), which produces
NaN for negative input values. This tool doesn't really have OOG
values in mind, but using an odd power function fixes this issue,
and is in line with the behavior of the other modes w.r.t. OOG
values.
app/gegl/gimp-gegl-loops.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-loops.c b/app/gegl/gimp-gegl-loops.c
index 87aad49..1824cdc 100644
--- a/app/gegl/gimp-gegl-loops.c
+++ b/app/gegl/gimp-gegl-loops.c
@@ -216,6 +216,16 @@ gimp_gegl_convolve (GeglBuffer *src_buffer,
g_free (src);
}
+static inline gfloat
+odd_powf (gfloat x,
+ gfloat y)
+{
+ if (x >= 0.0f)
+ return powf ( x, y);
+ else
+ return -powf (-x, y);
+}
+
void
gimp_gegl_dodgeburn (GeglBuffer *src_buffer,
const GeglRectangle *src_rect,
@@ -276,9 +286,9 @@ gimp_gegl_dodgeburn (GeglBuffer *src_buffer,
while (count--)
{
- *dest++ = pow (*src++, factor);
- *dest++ = pow (*src++, factor);
- *dest++ = pow (*src++, factor);
+ *dest++ = odd_powf (*src++, factor);
+ *dest++ = odd_powf (*src++, factor);
+ *dest++ = odd_powf (*src++, factor);
*dest++ = *src++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]