[gegl/threaded-base-classes: 12/22] operation: refactor in_place handling to take place in base classes
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/threaded-base-classes: 12/22] operation: refactor in_place handling to take place in base classes
- Date: Mon, 30 Jun 2014 02:15:54 +0000 (UTC)
commit ab1ce71529fc67435a1b2e1d5ab0a29f0a4775c0
Author: Øyvind Kolås <pippin gimp org>
Date: Tue Jun 24 08:13:49 2014 +0200
operation: refactor in_place handling to take place in base classes
Adding a flag to operation, that is used by the implementation/further
subclass to declare that in-place processing should be done if possible. This
also adds that capability to the base class of GIMPs layer modes.
gegl/operation/gegl-operation-composer3.c | 96 ++++++++++++++--------------
1 files changed, 48 insertions(+), 48 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index b885661..e55250f 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -27,26 +27,26 @@
#include "gegl-config.h"
static gboolean gegl_operation_composer3_process
- (GeglOperation *operation,
- GeglOperationContext *context,
- const gchar *output_prop,
- const GeglRectangle *result,
- gint level);
+(GeglOperation *operation,
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result,
+ gint level);
static void attach (GeglOperation *operation);
static GeglNode*detect (GeglOperation *operation,
- gint x,
- gint y);
+ gint x,
+ gint y);
static GeglRectangle get_bounding_box (GeglOperation *self);
static GeglRectangle get_required_for_output (GeglOperation *self,
- const gchar *input_pad,
- const GeglRectangle *roi);
+ const gchar *input_pad,
+ const GeglRectangle *roi);
G_DEFINE_TYPE (GeglOperationComposer3, gegl_operation_composer3,
- GEGL_TYPE_OPERATION)
+ GEGL_TYPE_OPERATION)
-static void
+ static void
gegl_operation_composer3_class_init (GeglOperationComposer3Class * klass)
{
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
@@ -61,50 +61,50 @@ gegl_operation_composer3_class_init (GeglOperationComposer3Class * klass)
operation_class->get_required_for_output = get_required_for_output;
}
-static void
+ static void
gegl_operation_composer3_init (GeglOperationComposer3 *self)
{
}
-static void
+ static void
attach (GeglOperation *self)
{
GeglOperation *operation = GEGL_OPERATION (self);
GParamSpec *pspec;
pspec = g_param_spec_object ("output",
- "Output",
- "Output pad for generated image buffer.",
- GEGL_TYPE_BUFFER,
- G_PARAM_READABLE |
- GEGL_PARAM_PAD_OUTPUT);
+ "Output",
+ "Output pad for generated image buffer.",
+ GEGL_TYPE_BUFFER,
+ G_PARAM_READABLE |
+ GEGL_PARAM_PAD_OUTPUT);
gegl_operation_create_pad (operation, pspec);
g_param_spec_sink (pspec);
pspec = g_param_spec_object ("input",
- "Input",
- "Input pad, for image buffer input.",
- GEGL_TYPE_BUFFER,
- G_PARAM_READWRITE |
- GEGL_PARAM_PAD_INPUT);
+ "Input",
+ "Input pad, for image buffer input.",
+ GEGL_TYPE_BUFFER,
+ G_PARAM_READWRITE |
+ GEGL_PARAM_PAD_INPUT);
gegl_operation_create_pad (operation, pspec);
g_param_spec_sink (pspec);
pspec = g_param_spec_object ("aux",
- "Aux",
- "Auxiliary image buffer input pad.",
- GEGL_TYPE_BUFFER,
- G_PARAM_READWRITE |
- GEGL_PARAM_PAD_INPUT);
+ "Aux",
+ "Auxiliary image buffer input pad.",
+ GEGL_TYPE_BUFFER,
+ G_PARAM_READWRITE |
+ GEGL_PARAM_PAD_INPUT);
gegl_operation_create_pad (operation, pspec);
g_param_spec_sink (pspec);
pspec = g_param_spec_object ("aux2",
- "Aux2",
- "Second auxiliary image buffer input pad.",
- GEGL_TYPE_BUFFER,
- G_PARAM_READWRITE |
- GEGL_PARAM_PAD_INPUT);
+ "Aux2",
+ "Second auxiliary image buffer input pad.",
+ GEGL_TYPE_BUFFER,
+ G_PARAM_READWRITE |
+ GEGL_PARAM_PAD_INPUT);
gegl_operation_create_pad (operation, pspec);
g_param_spec_sink (pspec);
}
@@ -127,8 +127,8 @@ static void thread_process (gpointer thread_data, gpointer unused)
{
ThreadData *data = thread_data;
if (!data->klass->process (data->operation,
- data->input, data->aux, data->aux2,
- data->output, &data->roi, data->level))
+ data->input, data->aux, data->aux2,
+ data->output, &data->roi, data->level))
data->success = FALSE;
g_atomic_int_add (data->pending, -1);
}
@@ -137,20 +137,20 @@ static GThreadPool *thread_pool (void)
{
static GThreadPool *pool = NULL;
if (!pool)
- {
- pool = g_thread_pool_new (thread_process, NULL, gegl_config()->threads,
- FALSE, NULL);
- }
+ {
+ pool = g_thread_pool_new (thread_process, NULL, gegl_config()->threads,
+ FALSE, NULL);
+ }
return pool;
}
-static gboolean
+ static gboolean
gegl_operation_composer3_process (GeglOperation *operation,
- GeglOperationContext *context,
- const gchar *output_prop,
- const GeglRectangle *result,
- gint level)
+ GeglOperationContext *context,
+ const gchar *output_prop,
+ const GeglRectangle *result,
+ gint level)
{
GeglOperationComposer3Class *klass = GEGL_OPERATION_COMPOSER3_GET_CLASS (operation);
GeglOperationClass *op_class = GEGL_OPERATION_CLASS (klass);
@@ -161,10 +161,10 @@ gegl_operation_composer3_process (GeglOperation *operation,
gboolean success = FALSE;
if (strcmp (output_prop, "output"))
- {
- g_warning ("requested processing of %s pad on a composer", output_prop);
- return FALSE;
- }
+ {
+ g_warning ("requested processing of %s pad on a composer", output_prop);
+ return FALSE;
+ }
if (result->width == 0 || result->height == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]