[gegl/soc-2011-seamless-clone: 5/49] More small fixed for autotools and code
- From: Barak Itkin <barakitkin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2011-seamless-clone: 5/49] More small fixed for autotools and code
- Date: Sat, 1 Dec 2012 13:50:56 +0000 (UTC)
commit 9d42e3570619d050ac462de60a42db1285c762dc
Author: Barak Itkin <lightningismyname gmail com>
Date: Tue Aug 2 21:32:15 2011 +0300
More small fixed for autotools and code
operations/common/seamless-clone/Makefile.am | 6 ++-
operations/common/seamless-clone/find-outline.c | 2 +
operations/common/seamless-clone/make-mesh.c | 2 +-
.../poly2tri-c/refine/triangulation.c | 2 +-
operations/common/seamless-clone/seamless-clone.c | 46 ++++++++++++++------
5 files changed, 40 insertions(+), 18 deletions(-)
---
diff --git a/operations/common/seamless-clone/Makefile.am b/operations/common/seamless-clone/Makefile.am
index 84cb3ed..30d5b39 100644
--- a/operations/common/seamless-clone/Makefile.am
+++ b/operations/common/seamless-clone/Makefile.am
@@ -1,6 +1,8 @@
SUBDIRS = poly2tri-c
-include $(top_srcdir)/operations/Makefile-operations.am
+include $(top_srcdir)/operations/Makefile-common.am
+
+LIBS = $(op_libs)
seamless_clone_la_SOURCES = \
make-mesh.c \
@@ -10,7 +12,7 @@ seamless_clone_la_SOURCES = \
seamless-clone.c \
seamless-clone.h
-seamless_clone_la_LIBADD = $(op_libs) poly2tri-c/libpoly2tri-c.la $(GLIB_LIBS)
+seamless_clone_la_LIBADD = $(op_libs) poly2tri-c/libpoly2tri-c.la
seamless_clone_la_CFLAGS = $(AM_CFLAGS) $(BABL_CFLAGS) $(GLIB_CFLAGS)
opdir = $(libdir)/gegl- GEGL_API_VERSION@
diff --git a/operations/common/seamless-clone/find-outline.c b/operations/common/seamless-clone/find-outline.c
index 042e6bf..acd0db1 100644
--- a/operations/common/seamless-clone/find-outline.c
+++ b/operations/common/seamless-clone/find-outline.c
@@ -205,6 +205,8 @@ sc_outline_find_ccw (GeglRectangle *rect,
DIRN = outline_walk_cw (rect, pixels, DIR,&pt,&ptN);
}
+ g_debug ("Outline has %d points", points->len);
+
return points;
}
diff --git a/operations/common/seamless-clone/make-mesh.c b/operations/common/seamless-clone/make-mesh.c
index 315af17..b45ce18 100644
--- a/operations/common/seamless-clone/make-mesh.c
+++ b/operations/common/seamless-clone/make-mesh.c
@@ -116,7 +116,7 @@ sc_compute_sample_list_weights (gdouble Px,
{
gdouble temp = 1;
g_ptr_array_remove_range (sl->points, 0, N);
- g_array_remove_range (sl->weights, 0, N);
+ /* No weights yet so nothing to remove */
g_ptr_array_add (sl->points, pt1);
g_array_append_val (sl->weights, temp);
diff --git a/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c b/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c
index f731a08..73e78e5 100755
--- a/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c
+++ b/operations/common/seamless-clone/poly2tri-c/refine/triangulation.c
@@ -178,7 +178,7 @@ p2tr_triangulation_get_points (P2tRTriangulation *self, GPtrArray *dest)
}
}
- g_hash_table_free (pts);
+ g_hash_table_destroy (pts);
}
/* ########################################################################## */
/* Point struct */
diff --git a/operations/common/seamless-clone/seamless-clone.c b/operations/common/seamless-clone/seamless-clone.c
index 6188626..9ad3941 100644
--- a/operations/common/seamless-clone/seamless-clone.c
+++ b/operations/common/seamless-clone/seamless-clone.c
@@ -39,18 +39,23 @@ get_required_for_output (GeglOperation *operation,
const gchar *input_pad,
const GeglRectangle *region)
{
- GeglRectangle result;
+ GeglRectangle *temp = NULL;
+ GeglRectangle result;
- if (g_strcmp0 (input_pad, "input"))
- result = *gegl_operation_source_get_bounding_box (operation, "input");
- else if (g_strcmp0 (input_pad, "aux"))
- result = *gegl_operation_source_get_bounding_box (operation, "aux");
+ g_debug ("seamless-clone.c::get_required_for_output");
+
+ if (g_strcmp0 (input_pad, "input") || g_strcmp0 (input_pad, "aux"))
+ temp = gegl_operation_source_get_bounding_box (operation, input_pad);
else
- g_assert_not_reached ();
-
- printf ("Input \"%s\" size is:\n", input_pad);
- gegl_rectangle_dump (&result);
+ g_warning ("seamless-clone::Unknown input pad \"%s\"\n", input_pad);
+ if (temp != NULL)
+ result = *temp;
+ else
+ {
+ result.width = result.height = 0;
+ }
+
return result;
}
@@ -59,6 +64,8 @@ prepare (GeglOperation *operation)
{
Babl *format = babl_format ("RGBA float");
+ g_debug ("seamless-clone.c::prepare");
+
gegl_operation_set_format (operation, "input", format);
gegl_operation_set_format (operation, "aux", format);
gegl_operation_set_format (operation, "output", format);
@@ -82,14 +89,16 @@ sc_point_to_color_func (P2tRPoint *point,
gint i;
guint N = sl->points->len;
- Babl *format = babl_format("RGB float");
+ Babl *format = babl_format ("RGBA float");
for (i = 0; i < N; i++)
{
P2tRPoint *pt = g_ptr_array_index (sl->points, i);
gdouble weight = g_array_index (sl->weights, gdouble, i);
-
+
+ g_assert (format != NULL);
gegl_buffer_sample (cci->aux_buf, pt->x, pt->y, NULL, aux_c, format, GEGL_INTERPOLATION_NEAREST);
+ g_assert (format != NULL);
gegl_buffer_sample (cci->input_buf, pt->x, pt->y, NULL, input_c, format, GEGL_INTERPOLATION_NEAREST);
dest_c[0] = weight * (input_c[0] - aux_c[0]);
@@ -124,7 +133,8 @@ process (GeglOperation *operation,
ScColorComputeInfo cci;
P2tRImageConfig imcfg;
- printf ("The aux_rect is:\n");
+ g_debug ("seamless-clone.c::process");
+ printf ("The aux_rect is: ");
gegl_rectangle_dump (&aux_rect);
/********************************************************************/
@@ -134,17 +144,23 @@ process (GeglOperation *operation,
/* First, find the paste outline */
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);
-
+
+ g_debug ("Start making outline");
outline = sc_outline_find_ccw (&aux_rect, aux_raw);
+ g_debug ("Finish making outline");
g_free (aux_raw);
aux_raw = NULL;
/* Then, Generate the mesh */
+ g_debug ("Start making fine mesh");
mesh = sc_make_fine_mesh (outline, &mesh_bounds);
+ g_debug ("Finish making fine mesh");
/* Finally, Generate the mesh sample list for each point */
+ g_debug ("Start computing sampling");
mesh_sampling = sc_mesh_sampling_compute (outline, mesh);
+ g_debug ("Finish computing sampling");
/* If caching of UV is desired, it shold be done here! */
@@ -166,8 +182,10 @@ process (GeglOperation *operation,
imcfg.x_samples = result->width;
imcfg.y_samples = result->height;
imcfg.cpp = 4;
-
+
+ g_debug ("Start mesh rendering");
p2tr_mesh_render_scanline (mesh, out_raw, &imcfg, sc_point_to_color_func, &cci);
+ g_debug ("Finish mesh rendering");
/* TODO: Add the aux to the mesh rendering! */
gegl_buffer_set (output, result, babl_format("RGBA float"), out_raw, GEGL_AUTO_ROWSTRIDE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]