Commit 744fdc8c authored by Daniel Sabo's avatar Daniel Sabo

Make gegl_object_set/get_has_forked functions

And move them to a semi-public location instead of gegl-node.h
parent ace2600f
......@@ -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
......
......@@ -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
/***
......
......@@ -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;
}
......@@ -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))
{
......
......@@ -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;
}
......
......@@ -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));
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment