[gegl] Make gegl_object_set/get_has_forked functions
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Make gegl_object_set/get_has_forked functions
- Date: Wed, 20 Nov 2013 02:15:27 +0000 (UTC)
commit 744fdc8c291d1c7d6569358f8445966997656903
Author: Daniel Sabo <DanielSabo gmail com>
Date: Tue Nov 19 13:02:12 2013 -0800
Make gegl_object_set/get_has_forked functions
And move them to a semi-public location instead of gegl-node.h
gegl/graph/gegl-node.h | 7 -------
gegl/operation/gegl-operation.h | 19 +++++++++++++++++++
gegl/operation/gegl-operations.c | 15 ++++++++++++++-
gegl/process/gegl-graph-traversal.c | 4 ++--
operations/common/buffer-source.c | 2 +-
operations/core/crop.c | 4 ++--
operations/transform/transform-core.c | 4 ++--
7 files changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/gegl/graph/gegl-node.h b/gegl/graph/gegl-node.h
index 918aa15..9e11716 100644
--- a/gegl/graph/gegl-node.h
+++ b/gegl/graph/gegl-node.h
@@ -223,13 +223,6 @@ void
gegl_node_emit_computed (GeglNode *node,
const GeglRectangle *rect);
-/* macros used to set flags on objects passed in the graph */
-
-#define gegl_object_set_has_forked(object) \
- g_object_set_data(G_OBJECT(object), "gegl has-forked", (void*)0xf)
-#define gegl_object_get_has_forked(object) \
- (g_object_get_data(G_OBJECT(object), "gegl has-forked")!=NULL)
-
#define GEGL_MAX_THREADS 16
G_END_DECLS
diff --git a/gegl/operation/gegl-operation.h b/gegl/operation/gegl-operation.h
index 8a476f8..21fa16e 100644
--- a/gegl/operation/gegl-operation.h
+++ b/gegl/operation/gegl-operation.h
@@ -269,6 +269,25 @@ gboolean gegl_operation_cl_set_kernel_args (GeglOperation *operation,
gboolean gegl_can_do_inplace_processing (GeglOperation *operation,
GeglBuffer *input,
const GeglRectangle *result);
+
+/**
+ * gegl_object_set_has_forked: (skip)
+ * @object: Object to mark
+ *
+ * Mark an object as "forked", indicating that it should not be modified
+ * in place by gegl operations. This should only be used inside of the
+ * process method of a GeglOperation subclass.
+ */
+void gegl_object_set_has_forked (GObject *object);
+
+/**
+ * gegl_object_get_has_forked: (skip)
+ * @object: Object to check
+ *
+ * Returns TRUE if the object has been marked as "forked".
+ */
+gboolean gegl_object_get_has_forked (GObject *object);
+
G_END_DECLS
/***
diff --git a/gegl/operation/gegl-operations.c b/gegl/operation/gegl-operations.c
index 195b634..3b44fb6 100644
--- a/gegl/operation/gegl-operations.c
+++ b/gegl/operation/gegl-operations.c
@@ -185,7 +185,7 @@ gboolean gegl_can_do_inplace_processing (GeglOperation *operation,
if (!input ||
GEGL_IS_CACHE (input))
return FALSE;
- if (gegl_object_get_has_forked (input))
+ if (gegl_object_get_has_forked (G_OBJECT (input)))
return FALSE;
if (input->format == gegl_operation_get_format (operation, "output") &&
@@ -193,3 +193,16 @@ gboolean gegl_can_do_inplace_processing (GeglOperation *operation,
return TRUE;
return FALSE;
}
+
+void
+gegl_object_set_has_forked (GObject *object)
+{
+ g_object_set_data (object, "gegl has-forked", (void*)0xf);
+}
+
+
+gboolean
+gegl_object_get_has_forked (GObject *object)
+{
+ return g_object_get_data(object, "gegl has-forked") != NULL;
+}
diff --git a/gegl/process/gegl-graph-traversal.c b/gegl/process/gegl-graph-traversal.c
index 82a339a..8d21db9 100644
--- a/gegl/process/gegl-graph-traversal.c
+++ b/gegl/process/gegl-graph-traversal.c
@@ -347,7 +347,7 @@ gegl_graph_get_shared_empty (GeglGraphTraversal *path)
{
path->shared_empty = gegl_buffer_new_ram (GEGL_RECTANGLE (0, 0, 0, 0),
babl_format ("RGBA float"));
- gegl_object_set_has_forked (path->shared_empty);
+ gegl_object_set_has_forked (G_OBJECT (path->shared_empty));
}
return path->shared_empty;
}
@@ -439,7 +439,7 @@ gegl_graph_process (GeglGraphTraversal *path)
g_list_length (targets));
if (g_list_length (targets) > 1)
- gegl_object_set_has_forked (operation_result);
+ gegl_object_set_has_forked (G_OBJECT (operation_result));
for (targets_iter = targets; targets_iter; targets_iter = g_list_next (targets_iter))
{
diff --git a/operations/common/buffer-source.c b/operations/common/buffer-source.c
index d21ef00..7711c9d 100644
--- a/operations/common/buffer-source.c
+++ b/operations/common/buffer-source.c
@@ -141,7 +141,7 @@ process (GeglOperation *operation,
/* mark that this buffer should not be used for in-place
* processing.
*/
- gegl_object_set_has_forked (o->buffer);
+ gegl_object_set_has_forked (G_OBJECT (o->buffer));
}
return TRUE;
}
diff --git a/operations/core/crop.c b/operations/core/crop.c
index 28e2d35..fbe986f 100644
--- a/operations/core/crop.c
+++ b/operations/core/crop.c
@@ -148,8 +148,8 @@ gegl_crop_process (GeglOperation *operation,
output = gegl_buffer_create_sub_buffer (input, &extent);
- if (gegl_object_get_has_forked (input))
- gegl_object_set_has_forked (output);
+ if (gegl_object_get_has_forked (G_OBJECT (input)))
+ gegl_object_set_has_forked (G_OBJECT (output));
gegl_operation_context_take_object (context, "output", G_OBJECT (output));
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 3bba9aa..3494ecc 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -1134,8 +1134,8 @@ gegl_transform_process (GeglOperation *operation,
source abyss) */
NULL);
- if (gegl_object_get_has_forked (input))
- gegl_object_set_has_forked (output);
+ if (gegl_object_get_has_forked (G_OBJECT (input)))
+ gegl_object_set_has_forked (G_OBJECT (output));
gegl_operation_context_take_object (context, "output", G_OBJECT (output));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]