[gegl] operations: use GEGL's float epsilon instead of redefining one



commit a8258a8c88fa12712c5e30d217047b781a44ec21
Author: Téo Mazars <teomazars gmail com>
Date:   Tue Dec 3 23:40:02 2013 +0100

    operations: use GEGL's float epsilon instead of redefining one

 operations/common/edge-laplace.c         |    3 +--
 operations/common/mosaic.c               |    7 +++----
 operations/common/stretch-contrast-hsv.c |    4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/operations/common/edge-laplace.c b/operations/common/edge-laplace.c
index 5e79ba6..e5df6b6 100644
--- a/operations/common/edge-laplace.c
+++ b/operations/common/edge-laplace.c
@@ -36,7 +36,6 @@
 
 #define LAPLACE_RADIUS 2
 #define CHUNK_SIZE     1024
-#define EPSILON        1e-5f
 #define SQR(x)         ((x)*(x))
 
 static void
@@ -216,7 +215,7 @@ edge_laplace (GeglBuffer          *src,
                           src_pix[c + 4 + src_width * 4]);
 
 
-            if (temp_value < EPSILON)
+            if (temp_value < GEGL_FLOAT_EPSILON)
               gradient[c] *= -1.0f;
           }
 
diff --git a/operations/common/mosaic.c b/operations/common/mosaic.c
index 6205f94..29dc833 100644
--- a/operations/common/mosaic.c
+++ b/operations/common/mosaic.c
@@ -89,7 +89,6 @@ gegl_chant_boolean   (antialiasing, _("Antialiasing"), TRUE,
 #define MAX_POINTS        12
 #define NB_CPN            4
 #define STD_DEV           1.0
-#define EPSILON           1e-5
 
 typedef enum
 {
@@ -1039,7 +1038,7 @@ grid_localize (const GeglRectangle *result,
             result->y + pt->y < 0 || result->y + pt->y >= mdatas->height)
           continue;
 
-        if (rand_localize > EPSILON)
+        if (rand_localize > GEGL_FLOAT_EPSILON)
           {
             /* Rely on global values to make gegl's tiles seamless */
             max_x = pt->x + (gint) rand_f (o->rand,
@@ -2139,7 +2138,7 @@ calc_spec_vec (SpecVec *vec,
 
   r = sqrt (SQR (x2 - x1) + SQR (y2 - y1));
 
-  if (r > EPSILON)
+  if (r > GEGL_FLOAT_EPSILON)
     {
       vec->norm_x = - (y2 - y1) / r;
       vec->norm_y =   (x2 - x1) / r;
@@ -2166,7 +2165,7 @@ distance (SpecVec *vec,
 
   l2 = SQR (vec->base_x - vec->base_x2) + SQR (vec->base_y - vec->base_y2);
 
-  if (l2 < EPSILON)
+  if (l2 < GEGL_FLOAT_EPSILON)
     return sqrt (SQR (vec->base_x - x) + SQR (vec->base_y - y));
 
   pv_x = x - vec->base_x;
diff --git a/operations/common/stretch-contrast-hsv.c b/operations/common/stretch-contrast-hsv.c
index 33b54dd..01e105d 100644
--- a/operations/common/stretch-contrast-hsv.c
+++ b/operations/common/stretch-contrast-hsv.c
@@ -84,13 +84,13 @@ buffer_get_auto_strech_data (GeglBuffer      *buffer,
 static void
 clean_autostretch_data (AutostretchData *data)
 {
-  if (data->sdiff < 1e-5)
+  if (data->sdiff < GEGL_FLOAT_EPSILON)
     {
       data->sdiff = 1.0;
       data->slo   = 0.0;
     }
 
-  if (data->vdiff < 1e-5)
+  if (data->vdiff < GEGL_FLOAT_EPSILON)
     {
       data->vdiff = 1.0;
       data->vlo   = 0.0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]