[gegl/soc-2011-seamless-clone: 4/23] Fix warnings of all types - compiler and autotools
- From: Barak Itkin <barakitkin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2011-seamless-clone: 4/23] Fix warnings of all types - compiler and autotools
- Date: Fri, 1 Jun 2012 12:39:12 +0000 (UTC)
commit 5acba24239e3fec981770e0e4427897a594f29b7
Author: Barak Itkin <lightningismyname gmail com>
Date: Tue Aug 2 18:29:04 2011 +0300
Fix warnings of all types - compiler and autotools
operations/common/seamless-clone/Makefile.am | 10 ++--
operations/common/seamless-clone/find-outline.c | 1 -
operations/common/seamless-clone/make-mesh.c | 38 ++++++--------
operations/common/seamless-clone/make-mesh.h | 3 +
.../seamless-clone/poly2tri-c/common/Makefile.am | 1 +
.../seamless-clone/poly2tri-c/refine/Makefile.am | 2 +
.../poly2tri-c/refine/triangulation.c | 13 ++++-
.../poly2tri-c/refine/triangulation.h | 10 ----
.../seamless-clone/poly2tri-c/render/Makefile.am | 5 ++-
.../seamless-clone/poly2tri-c/sweep/Makefile.am | 5 +-
operations/common/seamless-clone/seamless-clone.c | 55 ++++++++++----------
11 files changed, 74 insertions(+), 69 deletions(-)
---
diff --git a/operations/common/seamless-clone/Makefile.am b/operations/common/seamless-clone/Makefile.am
index 5d6cf97..84cb3ed 100644
--- a/operations/common/seamless-clone/Makefile.am
+++ b/operations/common/seamless-clone/Makefile.am
@@ -1,6 +1,6 @@
-include $(top_srcdir)/operations/Makefile-operations.am
+SUBDIRS = poly2tri-c
-ops = seamless-clone.la
+include $(top_srcdir)/operations/Makefile-operations.am
seamless_clone_la_SOURCES = \
make-mesh.c \
@@ -10,11 +10,11 @@ seamless_clone_la_SOURCES = \
seamless-clone.c \
seamless-clone.h
-seamless_clone_la_LIBADD = $(op_libs) poly2tri-c/poly2tri-c.la
-seamless_clone_CFLAGS = $(AM_CFLAGS)
+seamless_clone_la_LIBADD = $(op_libs) poly2tri-c/libpoly2tri-c.la $(GLIB_LIBS)
+seamless_clone_la_CFLAGS = $(AM_CFLAGS) $(BABL_CFLAGS) $(GLIB_CFLAGS)
opdir = $(libdir)/gegl- GEGL_API_VERSION@
-op_LTLIBRARIES = $(ops)
+op_LTLIBRARIES = seamless-clone.la
AM_CPPFLAGS += \
-I$(top_srcdir)/operations/common
diff --git a/operations/common/seamless-clone/find-outline.c b/operations/common/seamless-clone/find-outline.c
index d993718..042e6bf 100644
--- a/operations/common/seamless-clone/find-outline.c
+++ b/operations/common/seamless-clone/find-outline.c
@@ -27,7 +27,6 @@
* alpha exists
*/
-#include <cairo.h>
#include <gegl.h>
#include <stdio.h> /* TODO: get rid of this debugging way! */
diff --git a/operations/common/seamless-clone/make-mesh.c b/operations/common/seamless-clone/make-mesh.c
index 5d4a905..315af17 100644
--- a/operations/common/seamless-clone/make-mesh.c
+++ b/operations/common/seamless-clone/make-mesh.c
@@ -23,13 +23,13 @@
* inner point of the mesh will be defined.
*/
-#include <cairo.h>
#include <gegl.h>
#include <stdio.h> /* TODO: get rid of this debugging way! */
-#include "seamless-clone.h"
#include "poly2tri-c/poly2tri.h"
#include "poly2tri-c/refine/triangulation.h"
+#include "poly2tri-c/refine/refine.h"
+#include "seamless-clone.h"
#define g_ptr_array_index_cyclic(array,index_) g_ptr_array_index(array,(index_)%((array)->len))
@@ -60,7 +60,6 @@ sc_compute_sample_list_part (ScOutline *outline,
gdouble norm2 = sqrt (dx2 * dx2 + dy2 * dy2);
gdouble angle = acos ((dx1 * dx2 + dy1 * dy2) / (norm1 * norm2));
- gdouble div = real->len / (gdouble) basePointCount;
gint d = index2 - index1;
gdouble edist = real->len / (basePointCount * pow (2.5, k));
@@ -92,12 +91,10 @@ sc_compute_sample_list_weights (gdouble Px,
gint N = sl->points->len;
gdouble *tan_as_half = g_new (gdouble, N);
gdouble *norms = g_new (gdouble, N);
- gdouble *weights = g_new (gdouble, N);
gint i;
- gdouble weightTotal = 0, weightTemp;
- gint special = -1;
+ gdouble weightTemp;
sl->total_weight = 0;
@@ -118,8 +115,8 @@ sc_compute_sample_list_weights (gdouble Px,
if (norm1 == 0)
{
gdouble temp = 1;
- g_ptr_array_remove_range (sl->points, 0 N);
- g_array_remove_range (sl->weights, 0 N);
+ g_ptr_array_remove_range (sl->points, 0, N);
+ g_array_remove_range (sl->weights, 0, N);
g_ptr_array_add (sl->points, pt1);
g_array_append_val (sl->weights, temp);
@@ -165,15 +162,14 @@ sc_sample_list_compute (ScOutline *outline,
gint i, index1, index2;
sl->points = g_ptr_array_new ();
- sl->weight = g_array_new (FALSE, TRUE, sizeof (gdouble));
+ sl->weights = g_array_new (FALSE, TRUE, sizeof (gdouble));
for (i = 0; i < basePointCount; i++)
{
- k = 0;
index1 = (gint) (i * div);
index2 = (gint) ((i + 1) * div);
- sc_compute_sample_list_part (outline, index1, index2, Px, Py, sl, k);
+ sc_compute_sample_list_part (outline, index1, index2, Px, Py, sl, 0);
}
sc_compute_sample_list_weights (Px, Py, sl);
@@ -184,8 +180,8 @@ sc_sample_list_compute (ScOutline *outline,
void
sc_sample_list_free (ScSampleList *self)
{
- g_ptr_array_free (self->points);
- g_array_free (self->weights);
+ g_ptr_array_free (self->points, TRUE);
+ g_array_free (self->weights, TRUE);
g_slice_free (ScSampleList, self);
}
@@ -200,17 +196,17 @@ sc_mesh_sampling_compute (ScOutline *outline,
/* Note that the get_points function increases the refcount of the
* returned points, so we must unref them when done with them
*/
- p2tr_triangulation_get_points (mesh, points)
+ p2tr_triangulation_get_points (mesh, points);
for (i = 0; i < points->len; i++)
{
P2tRPoint *pt = (P2tRPoint*) g_ptr_array_index (points, i);
- ScSampleList *sl = sc_compute_sample_list (outline, pt->x, pt->y);
+ ScSampleList *sl = sc_sample_list_compute (outline, pt->x, pt->y);
g_hash_table_insert (pt2sample, pt, sl);
}
/* We will unref the points when freeing the hash table */
- g_ptr_array_free (points);
+ g_ptr_array_free (points, TRUE);
return pt2sample;
}
@@ -245,7 +241,7 @@ sc_make_fine_mesh (ScOutline *outline,
GeglRectangle *mesh_bounds)
{
GPtrArray *realOutline = (GPtrArray*) outline;
- gint i, N = ptList->len;
+ gint i, N = realOutline->len;
gint min_x = G_MAXINT, max_x = -G_MAXINT, min_y = G_MAXINT, max_y = -G_MAXINT;
/* An array of P2tRPoint*, holding the outline points */
@@ -255,7 +251,7 @@ sc_make_fine_mesh (ScOutline *outline,
for (i = 0; i < N; i++)
{
- SPoint *pt = (SPoint*) g_ptr_array_index (realOutline, i);
+ ScPoint *pt = (ScPoint*) g_ptr_array_index (realOutline, i);
min_x = MIN (pt->x, min_x);
min_y = MIN (pt->y, min_y);
@@ -264,7 +260,7 @@ sc_make_fine_mesh (ScOutline *outline,
/* No one should care if the points are given in reverse order,
* and prepending to the GList is more efficient */
- mesh_points = g_ptr_array_add (mesh_points, p2tr_point_new (pt->x, pt->y));
+ g_ptr_array_add (mesh_points, p2tr_point_new (pt->x, pt->y));
}
mesh_bounds->x = min_x;
@@ -276,10 +272,10 @@ sc_make_fine_mesh (ScOutline *outline,
for (i = 0; i < N; i++)
{
- p2tr_point_unref (g_ptr_array_index (mesh_points, i));
+ p2tr_point_unref ((P2tRPoint*) g_ptr_array_index (mesh_points, i));
}
- g_ptr_array_free (mesh_points);
+ g_ptr_array_free (mesh_points, TRUE);
return T;
}
diff --git a/operations/common/seamless-clone/make-mesh.h b/operations/common/seamless-clone/make-mesh.h
index 98abf8e..bc0427f 100644
--- a/operations/common/seamless-clone/make-mesh.h
+++ b/operations/common/seamless-clone/make-mesh.h
@@ -34,4 +34,7 @@ void sc_sample_list_free (ScSampleList *self);
ScMeshSampling* sc_mesh_sampling_compute (ScOutline *outline, P2tRTriangulation *mesh);
void sc_mesh_sampling_free (ScMeshSampling *self);
+P2tRTriangulation* sc_make_fine_mesh (ScOutline *outline, GeglRectangle *mesh_bounds);
+
+
#endif
diff --git a/operations/common/seamless-clone/poly2tri-c/common/Makefile.am b/operations/common/seamless-clone/poly2tri-c/common/Makefile.am
index 691e54c..e3d5f22 100644
--- a/operations/common/seamless-clone/poly2tri-c/common/Makefile.am
+++ b/operations/common/seamless-clone/poly2tri-c/common/Makefile.am
@@ -7,3 +7,4 @@ libpoly2tri_c_common_la_SOURCES = \
shapes.h \
utils.c \
utils.h
+libpoly2tri_c_common_la_CFLAGS = $(GLIB_CFLAGS)
diff --git a/operations/common/seamless-clone/poly2tri-c/refine/Makefile.am b/operations/common/seamless-clone/poly2tri-c/refine/Makefile.am
index 415726d..fd714c6 100644
--- a/operations/common/seamless-clone/poly2tri-c/refine/Makefile.am
+++ b/operations/common/seamless-clone/poly2tri-c/refine/Makefile.am
@@ -6,3 +6,5 @@ libpoly2tri_c_refine_la_SOURCES = \
triangulation.c \
triangulation.h \
utils.h
+
+libpoly2tri_c_refine_la_CFLAGS = $(GLIB_CFLAGS)
diff --git a/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c b/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c
index bcdea60..f731a08 100755
--- a/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c
+++ b/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c
@@ -4,6 +4,17 @@
#include "triangulation.h"
#include "../poly2tri.h"
+static void p2tr_edge_init (P2tREdge *self, P2tRPoint *start, P2tRPoint *end);
+
+static void p2tr_edge_init_private (P2tREdge *self, P2tRPoint *start, P2tRPoint *end, gboolean mirror);
+
+static void p2tr_edge_remove_private (P2tREdge *self, P2tRTriangulation *T);
+
+static void p2tr_point_init (P2tRPoint *self, gdouble x, gdouble y);
+
+static void p2tr_point_add_edge (P2tRPoint *self, P2tREdge *edge);
+
+
/* ########################################################################## */
/* Common math */
/* ########################################################################## */
@@ -147,7 +158,7 @@ p2tr_triangulation_add_tr (P2tRTriangulation *self, P2tRTriangle *tr)
void
p2tr_triangulation_get_points (P2tRTriangulation *self, GPtrArray *dest)
{
- P2tRHashSetIter iter;
+ P2trHashSetIter iter;
P2tRTriangle *tr;
P2tRHashSet *pts = p2tr_hash_set_set_new (g_direct_hash, g_direct_equal, NULL);
gint i;
diff --git a/operations/common/seamless-clone/poly2tri-c/refine/triangulation.h b/operations/common/seamless-clone/poly2tri-c/refine/triangulation.h
index f300cd8..10a2b36 100755
--- a/operations/common/seamless-clone/poly2tri-c/refine/triangulation.h
+++ b/operations/common/seamless-clone/poly2tri-c/refine/triangulation.h
@@ -121,12 +121,8 @@ struct P2tRPoint_
guint _refcount;
};
-static void p2tr_point_init (P2tRPoint *self, gdouble x, gdouble y);
-
P2tRPoint* p2tr_point_new (gdouble x, gdouble y);
-static void p2tr_point_add_edge (P2tRPoint *self, P2tREdge *edge);
-
void p2tr_point_remove_edge (P2tRPoint *self, P2tREdge *edge);
void p2tr_point_remove (P2tRPoint *self, P2tRTriangulation *T);
@@ -185,14 +181,8 @@ P2tREdge* p2tr_edge_new (P2tRPoint *start, P2tRPoint *end);
P2tREdge* p2tr_edge_new_private (P2tRPoint *start, P2tRPoint *end, gboolean mirror);
-static void p2tr_edge_init (P2tREdge *self, P2tRPoint *start, P2tRPoint *end);
-
-static void p2tr_edge_init_private (P2tREdge *self, P2tRPoint *start, P2tRPoint *end, gboolean mirror);
-
void p2tr_edge_remove (P2tREdge *self, P2tRTriangulation *T);
-static void p2tr_edge_remove_private (P2tREdge *self, P2tRTriangulation *T);
-
gboolean p2tr_edge_is_encroached_by (P2tREdge *self, P2tRPoint *other);
gboolean p2tr_edge_is_encroached (P2tREdge *self);
diff --git a/operations/common/seamless-clone/poly2tri-c/render/Makefile.am b/operations/common/seamless-clone/poly2tri-c/render/Makefile.am
index da2a6d2..97346e8 100644
--- a/operations/common/seamless-clone/poly2tri-c/render/Makefile.am
+++ b/operations/common/seamless-clone/poly2tri-c/render/Makefile.am
@@ -2,4 +2,7 @@ noinst_LTLIBRARIES = libpoly2tri-c-render.la
libpoly2tri_c_render_la_SOURCES = \
mesh-render.c \
- mesh-render.h \
+ mesh-render.h
+
+libpoly2tri_c_render_la_CFLAGS = $(GLIB_CFLAGS)
+
diff --git a/operations/common/seamless-clone/poly2tri-c/sweep/Makefile.am b/operations/common/seamless-clone/poly2tri-c/sweep/Makefile.am
index 0df052c..49f222f 100644
--- a/operations/common/seamless-clone/poly2tri-c/sweep/Makefile.am
+++ b/operations/common/seamless-clone/poly2tri-c/sweep/Makefile.am
@@ -1,11 +1,12 @@
noinst_LTLIBRARIES = libpoly2tri-c-sweep.la
libpoly2tri_c_sweep_la_SOURCES = \
- advancing-front.c \
- advancing-front.h \
+ advancing_front.c \
+ advancing_front.h \
cdt.c \
cdt.h \
sweep.c \
sweep.h \
sweep_context.c \
sweep_context.h
+libpoly2tri_c_sweep_la_CFLAGS = $(GLIB_CFLAGS)
diff --git a/operations/common/seamless-clone/seamless-clone.c b/operations/common/seamless-clone/seamless-clone.c
index 3aaec50..6188626 100644
--- a/operations/common/seamless-clone/seamless-clone.c
+++ b/operations/common/seamless-clone/seamless-clone.c
@@ -31,6 +31,7 @@
#include "poly2tri-c/poly2tri.h"
#include "poly2tri-c/refine/triangulation.h"
+#include "poly2tri-c/render/mesh-render.h"
#include "seamless-clone.h"
static GeglRectangle
@@ -73,32 +74,32 @@ typedef struct {
static void
sc_point_to_color_func (P2tRPoint *point,
gfloat *dest,
- gpointer *cci_p)
+ 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;
- const gint N = cci->points->len;
+ guint N = sl->points->len;
- /* This function should be very light, so save some effort! */
- const static Babl *format = babl_format("RGB float");
+ Babl *format = babl_format("RGB float");
for (i = 0; i < N; i++)
{
- P2tRPoint *pt = g_ptr_array_index (cci->sampling->points, i);
- gdouble weight = g_array_index (cci->sampling->weights, gdouble, i);
+ P2tRPoint *pt = g_ptr_array_index (sl->points, i);
+ gdouble weight = g_array_index (sl->weights, gdouble, i);
gegl_buffer_sample (cci->aux_buf, pt->x, pt->y, NULL, aux_c, format, GEGL_INTERPOLATION_NEAREST);
gegl_buffer_sample (cci->input_buf, pt->x, pt->y, NULL, input_c, format, GEGL_INTERPOLATION_NEAREST);
- dest_c[0] = weight * (input_buf[0] - aux_buf[0]);
- dest_c[1] = weight * (input_buf[1] - aux_buf[1]);
- dest_c[2] = weight * (input_buf[2] - aux_buf[2]);
+ dest_c[0] = weight * (input_c[0] - aux_c[0]);
+ dest_c[1] = weight * (input_c[1] - aux_c[1]);
+ dest_c[2] = weight * (input_c[2] - aux_c[2]);
}
- dest[0] = dest_c[0] / cci->sampling->total_weight;
- dest[1] = dest_c[1] / cci->sampling->total_weight;
- dest[2] = dest_c[2] / cci->sampling->total_weight;
+ dest[0] = dest_c[0] / sl->total_weight;
+ dest[1] = dest_c[1] / sl->total_weight;
+ dest[2] = dest_c[2] / sl->total_weight;
dest[3] = 1;
}
@@ -109,11 +110,9 @@ process (GeglOperation *operation,
GeglBuffer *output,
const GeglRectangle *result)
{
- GPtrArray *ptList;
gfloat *aux_raw, *out_raw;
- GeglRectangle input_rect = *gegl_buffer_get_extent (input);
- GeglRectangle aux_rect = *gegl_operation_source_get_bounding_box (operation, "aux");
+ GeglRectangle aux_rect = *gegl_operation_source_get_bounding_box (operation, "aux");
ScOutline *outline;
@@ -136,7 +135,7 @@ process (GeglOperation *operation,
aux_raw = g_new (gfloat, 4 * aux_rect.width * aux_rect.height);
gegl_buffer_get (aux, 1.0, &aux_rect, babl_format("RGBA float"), aux_raw, GEGL_AUTO_ROWSTRIDE);
- outline = outline_find_ccw (&aux_rect, aux_raw);
+ outline = sc_outline_find_ccw (&aux_rect, aux_raw);
g_free (aux_raw);
aux_raw = NULL;
@@ -154,19 +153,19 @@ process (GeglOperation *operation,
/********************************************************************/
/* Alocate the output buffer */
- out_raw = g_new (gfloat, 4 * result.width * result.height);
+ out_raw = g_new (gfloat, 4 * result->width * result->height);
/* Render the mesh into it */
- cci->aux_buf = aux;
- cci->input_buf = input;
- cci->sampling = mesh_sampling;
-
- imcfg->min_x = result->x;
- imcfg->min_y = result->y;
- imcfg->step_x = imcfg->step_y = 1;
- imcfg->x_samples = result->width;
- imcfg->y_samples = result->height;
- imcfg->cpp = 4;
+ cci.aux_buf = aux;
+ cci.input_buf = input;
+ cci.sampling = mesh_sampling;
+
+ imcfg.min_x = result->x;
+ imcfg.min_y = result->y;
+ imcfg.step_x = imcfg.step_y = 1;
+ imcfg.x_samples = result->width;
+ imcfg.y_samples = result->height;
+ imcfg.cpp = 4;
p2tr_mesh_render_scanline (mesh, out_raw, &imcfg, sc_point_to_color_func, &cci);
@@ -176,7 +175,7 @@ process (GeglOperation *operation,
/* Free memory, by the order things were allocated! */
g_free (out_raw);
sc_mesh_sampling_free (mesh_sampling);
- p2tr_triangulation_free (mes);
+ p2tr_triangulation_free (mesh);
sc_outline_free (outline);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]