[gegl/npd-squashed] npd: Mark some functions as static.



commit 0650a234285beafabafd478167e1c8c3d00eb1b2
Author: Michael Henning <drawoc darkrefraction com>
Date:   Mon Nov 18 18:39:45 2013 -0500

    npd: Mark some functions as static.

 libs/npd/deformation.c |   64 ++++++++++++++++++++++++------------------------
 libs/npd/deformation.h |   18 -------------
 libs/npd/graphics.h    |    4 +--
 libs/npd/lattice_cut.c |    2 +-
 libs/npd/lattice_cut.h |   12 +++------
 5 files changed, 38 insertions(+), 62 deletions(-)
---
diff --git a/libs/npd/deformation.c b/libs/npd/deformation.c
index caa5496..d8af889 100644
--- a/libs/npd/deformation.c
+++ b/libs/npd/deformation.c
@@ -22,7 +22,7 @@
 #include "deformation.h"
 #include <math.h>
 
-void
+static void
 npd_compute_centroid_of_overlapping_points (gint      num_of_points,
                                             NPDPoint *points[],
                                             gfloat    weights[],
@@ -45,7 +45,7 @@ npd_compute_centroid_of_overlapping_points (gint      num_of_points,
   centroid->y = y_sum / weights_sum;
 }
 
-void
+static void
 npd_compute_centroid_from_weighted_points (gint      num_of_points,
                                            NPDPoint  points[],
                                            gfloat    weights[],
@@ -67,7 +67,7 @@ npd_compute_centroid_from_weighted_points (gint      num_of_points,
   centroid->y = y_sum / weights_sum;
 }
 
-void
+static void
 npd_compute_ARSAP_transformation (gint     num_of_points,
                                   NPDPoint reference_points[],
                                   NPDPoint current_points[],
@@ -139,7 +139,7 @@ npd_compute_ARSAP_transformation (gint     num_of_points,
     }
 }
 
-void
+static void
 npd_compute_ARSAP_transformations (NPDHiddenModel *hidden_model)
 {
   gint     i;
@@ -156,18 +156,34 @@ npd_compute_ARSAP_transformations (NPDHiddenModel *hidden_model)
     }
 }
 
-void
-npd_deform_model (NPDModel *model,
-                  gint      rigidity)
+static void
+npd_deform_hidden_model_once (NPDHiddenModel *hidden_model)
 {
-  gint i;
-  for (i = 0; i < rigidity; ++i)
+  gint i, j;
+  npd_compute_ARSAP_transformations (hidden_model);
+
+  /* overlapping points are not overlapping after the deformation,
+     so we have to move them to their centroid */
+  for (i = 0; i < hidden_model->num_of_overlapping_points; ++i)
     {
-      npd_deform_model_once (model);
+      NPDOverlappingPoints *list_of_ops
+              = &hidden_model->list_of_overlapping_points[i];
+      NPDPoint centroid;
+
+      npd_compute_centroid_of_overlapping_points (list_of_ops->num_of_points,
+                                                  list_of_ops->points,
+                                                  NULL,
+                                                 &centroid);
+
+      for (j = 0; j < list_of_ops->num_of_points; ++j)
+        {
+          list_of_ops->points[j]->x = centroid.x;
+          list_of_ops->points[j]->y = centroid.y;
+        }
     }
 }
 
-void
+static void
 npd_deform_model_once (NPDModel *model)
 {
   gint i, j;
@@ -190,28 +206,12 @@ npd_deform_model_once (NPDModel *model)
 }
 
 void
-npd_deform_hidden_model_once (NPDHiddenModel *hidden_model)
+npd_deform_model (NPDModel *model,
+                  gint      rigidity)
 {
-  gint i, j;
-  npd_compute_ARSAP_transformations (hidden_model);
-
-  /* overlapping points are not overlapping after the deformation,
-     so we have to move them to their centroid */
-  for (i = 0; i < hidden_model->num_of_overlapping_points; ++i)
+  gint i;
+  for (i = 0; i < rigidity; ++i)
     {
-      NPDOverlappingPoints *list_of_ops
-              = &hidden_model->list_of_overlapping_points[i];
-      NPDPoint centroid;
-
-      npd_compute_centroid_of_overlapping_points (list_of_ops->num_of_points,
-                                                  list_of_ops->points,
-                                                  NULL,
-                                                 &centroid);
-
-      for (j = 0; j < list_of_ops->num_of_points; ++j)
-        {
-          list_of_ops->points[j]->x = centroid.x;
-          list_of_ops->points[j]->y = centroid.y;
-        }
+      npd_deform_model_once (model);
     }
 }
diff --git a/libs/npd/deformation.h b/libs/npd/deformation.h
index c363e1d..171f968 100644
--- a/libs/npd/deformation.h
+++ b/libs/npd/deformation.h
@@ -24,25 +24,7 @@
 
 #include "npd_common.h"
 
-void  npd_compute_centroid_from_weighted_points
-                                        (gint              num_of_points,
-                                         NPDPoint          points[],
-                                         gfloat            weights[],
-                                         NPDPoint         *centroid);
-void  npd_compute_centroid_of_overlapping_points
-                                        (gint              num_of_points,
-                                         NPDPoint         *points[],
-                                         gfloat            weights[],
-                                         NPDPoint         *centroid);
-void  npd_compute_ARSAP_transformation  (gint              num_of_points,
-                                         NPDPoint          reference_shape[],
-                                         NPDPoint          current_shape[],
-                                         gfloat            weights[],
-                                         gboolean          ASAP);
-void  npd_compute_ARSAP_transformations (NPDHiddenModel   *model);
 void  npd_deform_model                  (NPDModel         *model,
                                          gint              rigidity);
-void  npd_deform_model_once             (NPDModel         *model);
-void  npd_deform_hidden_model_once      (NPDHiddenModel   *hidden_model);
 
 #endif /* __NPD_DEFORMATION_H__ */
diff --git a/libs/npd/graphics.h b/libs/npd/graphics.h
index db174fc..457ac80 100644
--- a/libs/npd/graphics.h
+++ b/libs/npd/graphics.h
@@ -59,10 +59,8 @@ void        npd_draw_model                    (NPDModel   *model,
 void        npd_draw_mesh                     (NPDModel   *model,
                                                NPDDisplay *display);
 
-gboolean    npd_load_image                    (NPDImage   *image,
-                                               const char *path);
 void        npd_destroy_image                 (NPDImage   *image);
-//void        npd_draw_image                    (NPDImage *image);
+
 void        npd_texture_fill_triangle         (gint        x1,
                                                gint        y1,
                                                gint        x2,
diff --git a/libs/npd/lattice_cut.c b/libs/npd/lattice_cut.c
index d8e7f72..5bd7592 100644
--- a/libs/npd/lattice_cut.c
+++ b/libs/npd/lattice_cut.c
@@ -28,7 +28,7 @@
 #define NPD_SWAP_INTS(i,j) { gint tmp = i; i = j; j = tmp; }
 
 /* only works for straight lines */
-gboolean
+static gboolean
 npd_is_edge_empty (NPDImage *image,
                    gint      X1,
                    gint      Y1,
diff --git a/libs/npd/lattice_cut.h b/libs/npd/lattice_cut.h
index b331ba3..073c37e 100644
--- a/libs/npd/lattice_cut.h
+++ b/libs/npd/lattice_cut.h
@@ -19,22 +19,18 @@
  * Copyright (C) 2013 Marek Dvoroznak <dvoromar gmail com>
  */
 
-#ifndef __REFINE_H__
-#define        __REFINE_H__
+#ifndef __LATTICE_CUT_H__
+#define __LATTICE_CUT_H__
 
 #include "npd_common.h"
 
-gboolean     npd_is_edge_empty    (NPDImage *image,
-                                   gint      X1,
-                                   gint      Y1,
-                                   gint      X2,
-                                   gint      Y2);
 GList**      npd_find_edges       (NPDImage *image,
                                    gint      count_x,
                                    gint      count_y,
                                    gint      square_size);
+
 GList*       npd_cut_edges        (GList   **edges,
                                    gint      ow,
                                    gint      oh);
 
-#endif /* __REFINE_H__ */
+#endif /* __LATTICE_CUT_H__ */


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