mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
b349f1aa63
commit
e0dcf538e5
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue