[gegl] gegl:waves : avoid calling gegl_sampler_get with nan and/or inf values for x and y arguments.



commit 6a39f6a3468da074ec57af7ef21d42f55a9265f7
Author: Thomas Manni <thomas manni free fr>
Date:   Fri Sep 4 20:53:41 2015 +0200

    gegl:waves : avoid calling gegl_sampler_get with nan and/or inf values for x and y arguments.

 operations/common/waves.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/operations/common/waves.c b/operations/common/waves.c
index 2300431..1efd911 100644
--- a/operations/common/waves.c
+++ b/operations/common/waves.c
@@ -37,9 +37,9 @@ property_double (amplitude, _("Amplitude"), 25.0)
     description(_("Amplitude of the ripple"))
     value_range (0.0, 1000.0)
 
-property_double (period, _("Period"), 200)
+property_double (period, _("Period"), 200.0)
     description(_("Period (wavelength) of the ripple"))
-    value_range (0, 1000)
+    value_range (0.1, 1000.0)
 
 property_double (phi, _("Phase shift"), 0)
     value_range (-1, 1)
@@ -139,7 +139,10 @@ process (GeglOperation       *operation,
             dx = (x - px_x) * scalex;
             dy = (y - px_y) * scaley;
 
-            radius = sqrt (dx * dx + dy * dy);
+            if (!dx && !dy)
+              radius = 0.000001;
+            else
+              radius = sqrt (dx * dx + dy * dy);
 
             shift = o->amplitude * sin (2.0 * G_PI * radius / o->period +
                                         2.0 * G_PI * o->phi);


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