[gegl/soc-2011-seamless-clone] Fix the code to remove compiler warnings



commit 6ae85213872fbbd6da9b5b08adca8159b17d2d97
Author: Barak Itkin <lightningismyname gmail com>
Date:   Thu Mar 29 12:44:31 2012 +0200

    Fix the code to remove compiler warnings

 operations/common/seamless-clone/find-outline.c    |   28 ++++++++++----------
 operations/common/seamless-clone/find-outline.h    |    2 +-
 .../common/seamless-clone/seamless-clone-common.c  |   20 ++++++++------
 .../common/seamless-clone/seamless-clone-prepare.c |    6 ++--
 .../common/seamless-clone/seamless-clone-render.c  |    2 +-
 operations/common/seamless-clone/seamless-clone.c  |    2 +-
 6 files changed, 31 insertions(+), 29 deletions(-)
---
diff --git a/operations/common/seamless-clone/find-outline.c b/operations/common/seamless-clone/find-outline.c
index 9f0f7a9..ffee91a 100644
--- a/operations/common/seamless-clone/find-outline.c
+++ b/operations/common/seamless-clone/find-outline.c
@@ -99,7 +99,7 @@ in_range(gint val,gint min,gint max)
 }
 
 static inline gfloat
-sc_sample_alpha (GeglBuffer *buf, gint x, gint y, Babl *format)
+sc_sample_alpha (GeglBuffer *buf, gint x, gint y, const Babl *format)
 {
   gfloat col[4] = {0, 0, 0, 0};
   gegl_buffer_sample (buf, x, y, NULL, col, format, GEGL_SAMPLER_NEAREST);
@@ -107,10 +107,10 @@ sc_sample_alpha (GeglBuffer *buf, gint x, gint y, Babl *format)
 }
 
 static inline gboolean
-is_opaque (GeglRectangle *rect,
-           GeglBuffer    *pixels,
-           Babl          *format,
-           ScPoint       *pt)
+is_opaque (const GeglRectangle *rect,
+           GeglBuffer          *pixels,
+           const Babl          *format,
+           const ScPoint       *pt)
 {
   g_assert (pt != NULL);
   g_assert (rect != NULL);
@@ -135,12 +135,12 @@ is_opaque (GeglRectangle *rect,
  * 5. Return the result - moving by Dprev
  */
 static inline OUTLINE_DIRECTION
-outline_walk_cw (GeglRectangle      *rect,
-                 GeglBuffer         *pixels,
-                 Babl               *format,
-                 OUTLINE_DIRECTION   prevdirection,
-                 ScPoint            *pt,
-                 ScPoint            *dest)
+outline_walk_cw (const GeglRectangle *rect,
+                 GeglBuffer          *pixels,
+                 const Babl          *format,
+                 OUTLINE_DIRECTION    prevdirection,
+                 ScPoint             *pt,
+                 ScPoint             *dest)
 {
   OUTLINE_DIRECTION Dprev = oppositedirection(prevdirection);
   OUTLINE_DIRECTION Dnow = cwdirection (Dprev);
@@ -168,10 +168,10 @@ outline_walk_cw (GeglRectangle      *rect,
 
 GPtrArray*
 sc_outline_find_ccw (const GeglRectangle *rect,
-                     const GeglBuffer    *pixels)
+                     GeglBuffer          *pixels)
 {
-  Babl      *format = babl_format("RGBA float");
-  GPtrArray *points = g_ptr_array_new ();
+  const Babl *format = babl_format("RGBA float");
+  GPtrArray  *points = g_ptr_array_new ();
   
   gint x = rect->x, y;
 
diff --git a/operations/common/seamless-clone/find-outline.h b/operations/common/seamless-clone/find-outline.h
index 5eb44f5..f3762c2 100644
--- a/operations/common/seamless-clone/find-outline.h
+++ b/operations/common/seamless-clone/find-outline.h
@@ -33,7 +33,7 @@ typedef struct  {
  */
 typedef GPtrArray ScOutline;
 
-ScOutline* sc_outline_find_ccw (const GeglRectangle *rect, const GeglBuffer *pixels);
+ScOutline* sc_outline_find_ccw (const GeglRectangle *rect, GeglBuffer *pixels);
 
 void       sc_outline_free  (ScOutline *self);
 
diff --git a/operations/common/seamless-clone/seamless-clone-common.c b/operations/common/seamless-clone/seamless-clone-common.c
index 00366e8..886a718 100644
--- a/operations/common/seamless-clone/seamless-clone-common.c
+++ b/operations/common/seamless-clone/seamless-clone-common.c
@@ -19,6 +19,7 @@
 
 #include "seamless-clone-common.h"
 #include "make-mesh.h"
+#include <gegl-utils.h>
 
 static GeglBuffer*
 sc_compute_UVT_cache (P2tRTriangulation   *mesh,
@@ -58,13 +59,16 @@ sc_point_to_color_func (P2tRPoint *point,
                         gfloat    *dest,
                         gpointer   cci_p)
 {
-  ScColorComputeInfo *cci = (ScColorComputeInfo*) cci_p;
-  ScSampleList       *sl  = g_hash_table_lookup (cci->sampling, point);
-  gfloat aux_c[4], input_c[4], dest_c[3] = {0, 0, 0};
-  gint i;
-  gdouble weightT = 0;
-  guint N = sl->points->len;
+  ScColorComputeInfo *cci     = (ScColorComputeInfo*) cci_p;
+  ScSampleList       *sl      = g_hash_table_lookup (cci->sampling, point);
+  gint                i;
+  gdouble             weightT = 0;
+  guint               N       = sl->points->len;
+
+  const Babl         *format  = babl_format ("R'G'B'A float");
+
   gfloat *col_cpy;
+  gfloat aux_c[4], input_c[4], dest_c[3] = {0, 0, 0};
 
   if ((col_cpy = g_hash_table_lookup (cci->pt2col, point)) != NULL)
     {
@@ -78,8 +82,6 @@ sc_point_to_color_func (P2tRPoint *point,
   col_cpy = g_new (gfloat, 4);
   g_hash_table_insert (cci->pt2col, point, col_cpy);
 
-  Babl *format = babl_format ("R'G'B'A float");
-
   for (i = 0; i < N; i++)
     {
       ScPoint *pt = g_ptr_array_index (sl->points, i);
@@ -132,7 +134,7 @@ sc_render_seamless (GeglBuffer          *bg,
   GeglBufferIterator *iter;
   int out_index, uvt_index, fg_index;
   
-  Babl               *format = babl_format("R'G'B'A float");
+  const Babl         *format = babl_format("R'G'B'A float");
 
   if (cache == NULL)
     {
diff --git a/operations/common/seamless-clone/seamless-clone-prepare.c b/operations/common/seamless-clone/seamless-clone-prepare.c
index 1cf0946..873ca5e 100644
--- a/operations/common/seamless-clone/seamless-clone-prepare.c
+++ b/operations/common/seamless-clone/seamless-clone-prepare.c
@@ -47,8 +47,8 @@ gegl_chant_int (max_refine_steps, _("Refinement Steps"), 0, 100000.0, 2000,
 static void
 prepare (GeglOperation *operation)
 {
-  Babl     *format = babl_format ("R'G'B'A float");
-  gpointer *dest = GEGL_CHANT_PROPERTIES (operation) -> result;
+  const Babl *format = babl_format ("R'G'B'A float");
+  gpointer   *dest = GEGL_CHANT_PROPERTIES (operation) -> result;
 
   gegl_operation_set_format (operation, "input",  format);
 
@@ -64,7 +64,7 @@ process (GeglOperation       *operation,
          GeglBuffer          *input,
          const GeglRectangle *roi)
 {
-  gpointer           *dest = GEGL_CHANT_PROPERTIES (operation) -> result;
+  gpointer *dest = GEGL_CHANT_PROPERTIES (operation) -> result;
 
   if (dest == NULL)
     {
diff --git a/operations/common/seamless-clone/seamless-clone-render.c b/operations/common/seamless-clone/seamless-clone-render.c
index a3e51ab..15982fa 100644
--- a/operations/common/seamless-clone/seamless-clone-render.c
+++ b/operations/common/seamless-clone/seamless-clone-render.c
@@ -68,7 +68,7 @@ get_required_for_output (GeglOperation       *operation,
 static void
 prepare (GeglOperation *operation)
 {
-  Babl *format = babl_format ("R'G'B'A float");
+  const Babl *format = babl_format ("R'G'B'A float");
 
   gegl_operation_set_format (operation, "input",  format);
   gegl_operation_set_format (operation, "aux",    format);
diff --git a/operations/common/seamless-clone/seamless-clone.c b/operations/common/seamless-clone/seamless-clone.c
index 006642a..58e33fe 100644
--- a/operations/common/seamless-clone/seamless-clone.c
+++ b/operations/common/seamless-clone/seamless-clone.c
@@ -63,7 +63,7 @@ get_required_for_output (GeglOperation       *operation,
 static void
 prepare (GeglOperation *operation)
 {
-  Babl *format = babl_format ("R'G'B'A float");
+  const Babl *format = babl_format ("R'G'B'A float");
 
   gegl_operation_set_format (operation, "input",  format);
   gegl_operation_set_format (operation, "aux",    format);



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