From 20e49c0db0a3bd75848e0ac7c7c10c3e29c4e8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Fri, 4 Jan 2008 23:20:41 +0000 Subject: [PATCH] synchronised with GEGL headers. * app/gegl/gegl/gegl-operation-sink.h: * app/gegl/gegl/gegl-operation-source.h: * app/gegl/gegl/gegl-operation.h: synchronised with GEGL headers. * app/gegl/gimpoperationtilesink.c: * app/gegl/gimpoperationtilesource.c: added const GeglRectangle *result to arguments of _process(). svn path=/trunk/; revision=24536 --- ChangeLog | 10 +++++ app/gegl/gegl/gegl-operation-sink.h | 5 ++- app/gegl/gegl/gegl-operation-source.h | 8 ++-- app/gegl/gegl/gegl-operation.h | 65 ++++++++++++++++----------- app/gegl/gimpoperationtilesink.c | 18 ++++---- app/gegl/gimpoperationtilesource.c | 18 ++++---- 6 files changed, 75 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index afa6e179c5..8d2954210f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-01-04 Øyvind Kolås + + * app/gegl/gegl/gegl-operation-sink.h: + * app/gegl/gegl/gegl-operation-source.h: + * app/gegl/gegl/gegl-operation.h: synchronised with GEGL headers. + + * app/gegl/gimpoperationtilesink.c: + * app/gegl/gimpoperationtilesource.c: added const GeglRectangle + *result to arguments of _process(). + 2008-01-04 Sven Neumann * app/config/gimpdisplayconfig.c: changed the default marching ants diff --git a/app/gegl/gegl/gegl-operation-sink.h b/app/gegl/gegl/gegl-operation-sink.h index 6727b07999..ccef91f848 100644 --- a/app/gegl/gegl/gegl-operation-sink.h +++ b/app/gegl/gegl/gegl-operation-sink.h @@ -44,8 +44,9 @@ struct _GeglOperationSinkClass gboolean needs_full; - gboolean (* process) (GeglOperation *self, - gpointer context_id); + gboolean (* process) (GeglOperation *self, + gpointer context_id, + const GeglRectangle *result); }; GType gegl_operation_sink_get_type (void) G_GNUC_CONST; diff --git a/app/gegl/gegl/gegl-operation-source.h b/app/gegl/gegl/gegl-operation-source.h index db04205654..a9cf1c214b 100644 --- a/app/gegl/gegl/gegl-operation-source.h +++ b/app/gegl/gegl/gegl-operation-source.h @@ -38,10 +38,10 @@ struct _GeglOperationSource typedef struct _GeglOperationSourceClass GeglOperationSourceClass; struct _GeglOperationSourceClass { - GeglOperationClass parent_class; - - gboolean (*process) (GeglOperation *self, - gpointer context_id); + GeglOperationClass parent_class; + gboolean (*process) (GeglOperation *self, + gpointer context_id, + const GeglRectangle *result); }; GType gegl_operation_source_get_type (void) G_GNUC_CONST; diff --git a/app/gegl/gegl/gegl-operation.h b/app/gegl/gegl/gegl-operation.h index 2143a1aa2c..39416b4b14 100644 --- a/app/gegl/gegl/gegl-operation.h +++ b/app/gegl/gegl/gegl-operation.h @@ -74,8 +74,7 @@ struct _GeglOperationClass /* prepare the node for processing (all properties will be set) override this * if you are creating a meta operation (using the node as a GeglGraph). */ - void (*prepare) (GeglOperation *operation, - gpointer context_id); + void (*prepare) (GeglOperation *operation); /* Returns a bounding rectangle for the data that is defined by this op. (is * already implemented in GeglOperationPointFilter and @@ -112,28 +111,41 @@ struct _GeglOperationClass gint x, gint y); - /* do the actual processing needed to put GeglBuffers on the output pad */ - gboolean (*process) (GeglOperation *operation, - gpointer context_id, - const gchar *output_pad); + /* XXX: get array of in Gvalues and out Gvalues, filled with buffers? */ + + /* do the actual processing needed to put GeglBuffers on the output pad + * Replace context_id with an actual object? + * + * GeglOperationData <- per evaluation unique data for operation? + * (or node?) + * + * .. compute_input request? + * + */ + gboolean (*process) (GeglOperation *operation, + /* + GValue **pads, + const gchar **pad_names, + gint n_pads, + const GeglRectangle *result_rect, + const GeglRectangle *requested_rect, + */ + + gpointer context_id, + const gchar *output_pad, + const GeglRectangle *result_rect + ); + }; /* returns|registers the gtype for GeglOperation */ GType gegl_operation_get_type (void) G_GNUC_CONST; -/* returns the ROI passed to _this_ operation */ -const GeglRectangle * - gegl_operation_get_requested_region (GeglOperation *operation, - gpointer context_id); - /* retrieves the bounding box of a connected input */ GeglRectangle * gegl_operation_source_get_defined_region (GeglOperation *operation, const gchar *pad_name); -/* retrieves the node providing data to a named input pad */ -GeglNode * gegl_operation_get_source_node (GeglOperation *operation, - const gchar *pad_name); /* sets the ROI needed to be computed on one of the sources */ void gegl_operation_set_source_region (GeglOperation *operation, @@ -141,6 +153,7 @@ void gegl_operation_set_source_region (GeglOperation *operation, const gchar *pad_name, GeglRectangle *region); +#if 0 /* returns the bounding box of the buffer that needs to be computed */ const GeglRectangle * gegl_operation_result_rect (GeglOperation *operation, gpointer context_id); @@ -148,10 +161,15 @@ const GeglRectangle * gegl_operation_result_rect (GeglOperation *operation, /* returns the bounding box of the buffer needed for computation */ const GeglRectangle * gegl_operation_need_rect (GeglOperation *operation, gpointer context_id); +#endif /* virtual method invokers that depends only on the set properties of a * operation|node */ + +/* retrieves the node providing data to a named input pad */ +GeglNode * gegl_operation_get_source_node (GeglOperation *operation, + const gchar *pad_name); GeglRectangle gegl_operation_compute_affected_region (GeglOperation *operation, const gchar *input_pad, GeglRectangle region); @@ -174,11 +192,11 @@ GeglNode *gegl_operation_detect (GeglOperation *operation, void gegl_operation_attach (GeglOperation *operation, GeglNode *node); -void gegl_operation_prepare (GeglOperation *operation, - gpointer context_id); +void gegl_operation_prepare (GeglOperation *operation); gboolean gegl_operation_process (GeglOperation *operation, gpointer context_id, - const gchar *output_pad); + const gchar *output_pad, + const GeglRectangle *result_rect); /* retrieve the buffer that we are going to write into, it will be of the @@ -204,7 +222,8 @@ void gegl_operation_class_set_name (GeglOperationClass *operati /* create a pad for a specified property for this operation, this method is * to be called from the attach method of operations, most operations do not - * have to care about this since a super class will do it for them. + * have to care about this since a super class like filter, sink, source or + * composer already does so. */ void gegl_operation_create_pad (GeglOperation *operation, GParamSpec *param_spec); @@ -224,9 +243,9 @@ GType gegl_operation_gtype_from_name (const gchar *name); - -/* set a dynamic named instance for this node, this function takes over ownership - * of the reference (mostly used to set the "output" GeglBuffer) for operations +/* set a dynamic named instance for this node, this function takes over + * ownership of the reference (should only be used for internal GeglOperation + * implementations that override caching behaviour, use with care) */ void gegl_operation_set_data (GeglOperation *operation, gpointer context_id, @@ -246,10 +265,6 @@ GObject * gegl_operation_get_data (GeglOperation *operation, const gchar *property_name); -GeglBuffer * gegl_operation_get_source (GeglOperation *operation, - gpointer context_id, - const gchar *pad_name); - gboolean gegl_operation_calc_source_regions (GeglOperation *operation, gpointer context_id); diff --git a/app/gegl/gimpoperationtilesink.c b/app/gegl/gimpoperationtilesink.c index 4bd3300c54..b15f9c2edb 100644 --- a/app/gegl/gimpoperationtilesink.c +++ b/app/gegl/gimpoperationtilesink.c @@ -65,7 +65,9 @@ static void gimp_operation_tile_sink_set_property (GObject *object, GParamSpec *pspec); static gboolean gimp_operation_tile_sink_process (GeglOperation *operation, - gpointer context_id); + gpointer context_id, + const GeglRectangle *need, + const GeglRectangle *result); G_DEFINE_TYPE (GimpOperationTileSink, gimp_operation_tile_sink, @@ -190,8 +192,9 @@ gimp_operation_tile_sink_set_property (GObject *object, } static gboolean -gimp_operation_tile_sink_process (GeglOperation *operation, - gpointer context_id) +gimp_operation_tile_sink_process (GeglOperation *operation, + gpointer context_id, + const GeglRectangle *result) { GimpOperationTileSink *self = GIMP_OPERATION_TILE_SINK (operation); @@ -199,13 +202,10 @@ gimp_operation_tile_sink_process (GeglOperation *operation, { GeglBuffer *input; const Babl *format; - const GeglRectangle *extent; PixelRegion destPR; const guint bpp = tile_manager_bpp (self->tile_manager); gpointer pr; - extent = gegl_operation_result_rect (operation, context_id); - if (self->linear) format = gimp_bpp_to_babl_format_linear (bpp); else @@ -215,8 +215,8 @@ gimp_operation_tile_sink_process (GeglOperation *operation, "input")); pixel_region_init (&destPR, self->tile_manager, - extent->x, extent->y, - extent->width, extent->height, + result->x, result->y, + result->width, result->height, TRUE); for (pr = pixel_regions_register (1, &destPR); @@ -230,7 +230,7 @@ gimp_operation_tile_sink_process (GeglOperation *operation, } g_signal_emit (operation, tile_sink_signals[DATA_WRITTEN], 0, - extent); + result); } else { diff --git a/app/gegl/gimpoperationtilesource.c b/app/gegl/gimpoperationtilesource.c index 0d101be4a8..f8e1eaf0f1 100644 --- a/app/gegl/gimpoperationtilesource.c +++ b/app/gegl/gimpoperationtilesource.c @@ -59,7 +59,9 @@ static GeglRectangle gimp_operation_tile_source_get_defined_region (GeglOperation *operation); static gboolean gimp_operation_tile_source_process (GeglOperation *operation, - gpointer context_id); + gpointer context_id, + const GeglRectangle *need, + const GeglRectangle *result); G_DEFINE_TYPE (GimpOperationTileSource, gimp_operation_tile_source, @@ -195,8 +197,9 @@ gimp_operation_tile_source_get_defined_region (GeglOperation *operation) } static gboolean -gimp_operation_tile_source_process (GeglOperation *operation, - gpointer context_id) +gimp_operation_tile_source_process (GeglOperation *operation, + gpointer context_id, + const GeglRectangle *result) { GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation); @@ -204,23 +207,20 @@ gimp_operation_tile_source_process (GeglOperation *operation, { GeglBuffer *output; const Babl *format; - const GeglRectangle *extent; PixelRegion srcPR; const guint bpp = tile_manager_bpp (self->tile_manager); gpointer pr; - extent = gegl_operation_result_rect (operation, context_id); - if (self->linear) format = gimp_bpp_to_babl_format_linear (bpp); else format = gimp_bpp_to_babl_format (bpp); - output = gegl_buffer_new (extent, format); + output = gegl_buffer_new (result, format); pixel_region_init (&srcPR, self->tile_manager, - extent->x, extent->y, - extent->width, extent->height, + result->x, result->y, + result->width, result->height, FALSE); for (pr = pixel_regions_register (1, &srcPR);