[gegl] levels: improve handling of empty input ranges
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] levels: improve handling of empty input ranges
- Date: Sun, 22 Mar 2020 23:26:19 +0000 (UTC)
commit 08015456474728decb8b45e10954f60f9195e3d7
Author: Ell <ell_se yahoo com>
Date: Mon Mar 23 01:16:09 2020 +0200
levels: improve handling of empty input ranges
operations/common/levels.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/operations/common/levels.c b/operations/common/levels.c
index 3990ec01e..11fb7123e 100644
--- a/operations/common/levels.c
+++ b/operations/common/levels.c
@@ -19,7 +19,9 @@
#include "config.h"
#include <glib/gi18n-lib.h>
+#include <math.h>
+#define EPSILON 1e-6
#ifdef GEGL_PROPERTIES
@@ -80,8 +82,8 @@ process (GeglOperation *op,
in_range = o->in_high-o->in_low;
out_range = o->out_high-o->out_low;
- if (in_range == 0.0)
- in_range = 0.00000001;
+ if (fabsf (in_range) <= EPSILON)
+ in_range = copysignf (EPSILON, in_range);
scale = out_range/in_range;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]