[gimp] Clamp levels after input changes applied.
- From: Sven Neumann <neo src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp] Clamp levels after input changes applied.
- Date: Thu, 16 Jul 2009 20:06:49 +0000 (UTC)
commit fc66ca5169aea63c0f52ff799511c644c4661eba
Author: Mason Thomas <mason_thomas hotmail com>
Date: Wed Jul 15 22:50:06 2009 -0700
Clamp levels after input changes applied.
app/base/levels.c | 8 ++++----
app/gegl/gimpoperationlevels.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/app/base/levels.c b/app/base/levels.c
index 4be2da6..16fff75 100644
--- a/app/base/levels.c
+++ b/app/base/levels.c
@@ -90,12 +90,12 @@ levels_lut_func (Levels *levels,
inten = (gdouble) (255.0 * inten - levels->low_input[j]);
}
+ /* clamp to new black and white points */
+ inten = CLAMP (inten, 0.0, 1.0);
+
if (levels->gamma[j] != 0.0)
{
- if (inten >= 0.0)
- inten = pow ( inten, (1.0 / levels->gamma[j]));
- else
- inten = -pow (-inten, (1.0 / levels->gamma[j]));
+ inten = pow ( inten, (1.0 / levels->gamma[j]));
}
/* determine the output intensity */
diff --git a/app/gegl/gimpoperationlevels.c b/app/gegl/gimpoperationlevels.c
index 01cc7b1..d7a706a 100644
--- a/app/gegl/gimpoperationlevels.c
+++ b/app/gegl/gimpoperationlevels.c
@@ -89,12 +89,12 @@ gimp_operation_levels_map (gdouble value,
else
value = (value - low_input);
+ /* clamp to new black and white points */
+ value = CLAMP (value, 0.0, 1.0);
+
if (inv_gamma != 1.0)
{
- if (value >= 0.0)
- value = pow ( value, inv_gamma);
- else
- value = -pow (-value, inv_gamma);
+ value = pow ( value, inv_gamma);
}
/* determine the output intensity */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]