[gegl] property-types: Make gegl_path_calc return a boolean



commit 3020ad0bd1135b7521a9b93140d28f9db42f6106
Author: Damien de Lemeny <d delemeny gmail com>
Date:   Tue Jul 20 14:16:21 2010 +0200

    property-types: Make gegl_path_calc return a boolean

 gegl/property-types/gegl-path.c |   29 ++++++++++++++++++++---------
 gegl/property-types/gegl-path.h |    2 +-
 2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/gegl/property-types/gegl-path.c b/gegl/property-types/gegl-path.c
index bf612dd..50af23a 100644
--- a/gegl/property-types/gegl-path.c
+++ b/gegl/property-types/gegl-path.c
@@ -446,7 +446,7 @@ path_calc (GeglPathList *path,
     }
 }
 
-static void
+static gboolean
 path_calc2 (GeglPathList *path,
            gdouble       pos,
            gdouble      *xd,
@@ -511,7 +511,7 @@ path_calc2 (GeglPathList *path,
 
                   *stop = prev;
                   *leftover += traveled;
-                  return;
+                  return TRUE;
                 }
 
               traveled = next_pos;
@@ -527,7 +527,8 @@ path_calc2 (GeglPathList *path,
         }
       iter=iter->next;
     }
-  fprintf (stderr, "outside iterator bounds");
+  /*fprintf (stderr, "outside iterator bounds");*/
+  return FALSE;
 }
 
 static void path_calc_values (GeglPathList *path,
@@ -1055,7 +1056,7 @@ void gegl_path_get_bounds (GeglPath *self,
 
 
 
-void
+gboolean
 gegl_path_calc (GeglPath   *self,
                 gdouble     pos,
                 gdouble    *xd,
@@ -1066,6 +1067,7 @@ gegl_path_calc (GeglPath   *self,
   GeglPathList *stop  = NULL;
   gdouble rel_pos  = 0.0;
   gdouble leftover = 0.0;
+  gboolean result = FALSE;
 
   if (!self)
     return;
@@ -1084,11 +1086,20 @@ gegl_path_calc (GeglPath   *self,
       rel_pos = pos;
     }
     
-  path_calc2 (entry,rel_pos,xd,yd,&stop,&leftover);
-  
-  priv->calc_stop = stop;
-  priv->calc_leftover = leftover;
-  priv->calc_clean = TRUE;
+  if (path_calc2 (entry,rel_pos,xd,yd,&stop,&leftover))
+    {
+      priv->calc_stop = stop;
+      priv->calc_leftover = leftover;
+      priv->calc_clean = TRUE;
+
+      result = TRUE;
+    }
+  else
+    {
+      priv->calc_clean = FALSE;
+      result = FALSE;
+    }
+  return result;
 }
 
 
diff --git a/gegl/property-types/gegl-path.h b/gegl/property-types/gegl-path.h
index e872e8a..2628c8c 100644
--- a/gegl/property-types/gegl-path.h
+++ b/gegl/property-types/gegl-path.h
@@ -231,7 +231,7 @@ gdouble              gegl_path_closest_point  (GeglPath     *path,
  * Compute the coordinates of the path at the @position (length measured from
  * start of path, not including discontinuities).
  */
-void                 gegl_path_calc           (GeglPath     *path,
+gboolean             gegl_path_calc           (GeglPath     *path,
                                                gdouble       pos,
                                                gdouble      *x,
                                                gdouble      *y);



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