[gegl] add a rel_dim for the relative coordinates used in source files
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] add a rel_dim for the relative coordinates used in source files
- Date: Sun, 3 Apr 2016 15:15:09 +0000 (UTC)
commit 6a060bb9f57eb96449b06f93cdd0675f27cd0dff
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Apr 2 12:03:39 2016 +0200
add a rel_dim for the relative coordinates used in source files
bin/gegl.c | 2 +-
bin/ui.c | 2 +-
gegl/gegl-serialize.c | 18 +++++++++---------
gegl/gegl-utils.c | 1 -
gegl/gegl-utils.h | 4 ++--
operations/common/gegl.c | 8 +++++---
6 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/bin/gegl.c b/bin/gegl.c
index 9d3a295..6fcc28c 100644
--- a/bin/gegl.c
+++ b/bin/gegl.c
@@ -205,7 +205,7 @@ main (gint argc,
if (o->rest)
{
GError *error = NULL;
- gegl_create_chain_argv (o->rest, iter, proxy, 0, &error);
+ gegl_create_chain_argv (o->rest, iter, proxy, 0, gegl_node_get_bounding_box (gegl).height, &error);
if (error)
{
fprintf (stderr, "Error: %s\n", error->message);
diff --git a/bin/ui.c b/bin/ui.c
index e797831..d9d36a5 100644
--- a/bin/ui.c
+++ b/bin/ui.c
@@ -1371,7 +1371,7 @@ static void load_path (State *o)
GError *error = NULL;
gegl_create_chain_argv (o->ops,
gegl_node_get_producer (o->sink, "input", NULL),
- o->sink, 0,
+ o->sink, 0, gegl_node_get_bounding_box (o->sink).height,
&error);
if (error)
{
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index 7128838..f49a56a 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -20,7 +20,10 @@
#include <string.h>
#include <stdio.h>
-void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, double time, GError **error)
+//#define make_rel(strv) (g_strtod (strv, NULL) * gegl_node_get_bounding_box (iter[0]).height)
+#define make_rel(strv) (g_strtod (strv, NULL) * rel_dim)
+
+void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, double time, int rel_dim, GError
**error)
{
GeglNode *iter[10] = {start, NULL};
GeglNode *new = NULL;
@@ -51,8 +54,7 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
value[-1] = '\0';
if (strstr (value, "rel"))
{
- gegl_curve_add_point (curve, g_strtod (key, NULL),
- g_strtod (value, NULL) * gegl_node_get_bounding_box (iter[0]).height);
+ gegl_curve_add_point (curve, g_strtod (key, NULL), make_rel (value));
}
else
{
@@ -184,11 +186,9 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
g_object_set_qdata_full (G_OBJECT (new), g_quark_from_string(key), g_strdup (value),
g_free);
if (g_type_is_a (target_type, G_TYPE_INT))
- gegl_node_set (iter[level], key,
- (int)(g_strtod (value, NULL) * gegl_node_get_bounding_box (iter[0]).height), NULL);
+ gegl_node_set (iter[level], key, (int)make_rel (value), NULL);
else
- gegl_node_set (iter[level], key,
- g_strtod (value, NULL) * gegl_node_get_bounding_box (iter[0]).height, NULL);
+ gegl_node_set (iter[level], key, make_rel (value), NULL);
}
else
@@ -315,14 +315,14 @@ void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, doubl
gegl_node_link_many (iter[level], proxy, NULL);
}
-void gegl_create_chain (const char *str, GeglNode *op_start, GeglNode *op_end, double time, GError **error)
+void gegl_create_chain (const char *str, GeglNode *op_start, GeglNode *op_end, double time, int rel_dim,
GError **error)
{
gchar **argv = NULL;
gint argc = 0;
g_shell_parse_argv (str, &argc, &argv, NULL);
if (argv)
{
- gegl_create_chain_argv (argv, op_start, op_end, time, error);
+ gegl_create_chain_argv (argv, op_start, op_end, time, rel_dim, error);
g_strfreev (argv);
}
}
diff --git a/gegl/gegl-utils.c b/gegl/gegl-utils.c
index bb94b4b..ffe0650 100644
--- a/gegl/gegl-utils.c
+++ b/gegl/gegl-utils.c
@@ -26,7 +26,6 @@
#include "gegl-utils.h"
#include "gegl-types-internal.h"
-
gint
_gegl_float_epsilon_zero (float value)
{
diff --git a/gegl/gegl-utils.h b/gegl/gegl-utils.h
index 3554d32..3f4dc71 100644
--- a/gegl/gegl-utils.h
+++ b/gegl/gegl-utils.h
@@ -262,8 +262,8 @@ gint _gegl_float_epsilon_equal (float v1,
/**
*/
-void gegl_create_chain (const char *str, GeglNode *op_start, GeglNode *op_end, double time, GError
**error);
-void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, double time, GError **error);
+void gegl_create_chain_argv (char **ops, GeglNode *start, GeglNode *proxy, double time, int rel_dim, GError
**error);
+void gegl_create_chain (const char *str, GeglNode *op_start, GeglNode *op_end, double time, int rel_dim,
GError **error);
gchar *gegl_serialize (GeglNode *start, GeglNode *end);
G_END_DECLS
diff --git a/operations/common/gegl.c b/operations/common/gegl.c
index 5d77c76..7b21b92 100644
--- a/operations/common/gegl.c
+++ b/operations/common/gegl.c
@@ -78,13 +78,15 @@ prepare (GeglOperation *operation)
output = gegl_node_get_output_proxy (gegl, "output");
// gegl_node_link_many (input, output, NULL);
- gegl_create_chain (o->string, input, output, 0.0, &error);
+ gegl_create_chain (o->string, input, output, 0.0,
+ gegl_node_get_bounding_box (input).height,
+ &error);
if (error)
{
- //gegl_node_set (gegl, "error", error->message, NULL);
+ gegl_node_set (gegl, "error", error->message, NULL);
g_object_set (operation, "error", error->message, NULL);
- g_object_notify (operation, "error");
+ //g_object_notify (operation, "error");
g_error_free (error);
error = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]