From 1f4c2a1f96756e30166c323ffdeaabdd18f49eff Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 2 Oct 2007 05:54:44 +0000 Subject: [PATCH] clamp values used for the exponent map to 1..255. Fixes bug #478618. 2007-10-02 Sven Neumann * plug-ins/common/oilify.c (get_map_value): clamp values used for the exponent map to 1..255. Fixes bug #478618. svn path=/trunk/; revision=23715 --- ChangeLog | 5 +++++ plug-ins/common/oilify.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6829b326a..0e067bc928 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-02 Sven Neumann + + * plug-ins/common/oilify.c (get_map_value): clamp values used for + the exponent map to 1..255. Fixes bug #478618. + 2007-10-02 Kevin Cozens * plug-ins/script-fu/scripts/guides-new.scm: Use 'list' to create diff --git a/plug-ins/common/oilify.c b/plug-ins/common/oilify.c index 5eb238c5e8..9a1e68da53 100644 --- a/plug-ins/common/oilify.c +++ b/plug-ins/common/oilify.c @@ -270,15 +270,18 @@ run (const gchar *name, * Helper function to read a sample from a mask-size/exponent map */ static inline gfloat -get_map_value (guchar *src, - gint bpp) +get_map_value (const guchar *src, + gint bpp) { gfloat value; if (bpp >= 3) value = GIMP_RGB_LUMINANCE (src[0], src[1], src[2]); else - value = (gfloat) *src; + value = *src; + + if (value < 1.0) + value = 1.0; /* value should be in [0,1] */ value /= 255.0;