From 5adffe394a2a294b42b4689a32cd103fdd86eca3 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 30 Dec 2007 15:59:23 +0000 Subject: [PATCH] minor cleanup. 2007-12-30 Michael Natterer * app/gegl/gimpoperationtilesource.c: minor cleanup. * app/gegl/gimpoperationtilesink.[ch]: add "data-written" signal that is emitted whenever pixels have been written to the tile manager. svn path=/trunk/; revision=24484 --- ChangeLog | 8 ++++++++ app/gegl/gimpoperationtilesink.c | 31 +++++++++++++++++++++++++----- app/gegl/gimpoperationtilesink.h | 3 +++ app/gegl/gimpoperationtilesource.c | 18 ++++++++--------- 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index b27cf556f1..3ee1cc02ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-12-30 Michael Natterer + + * app/gegl/gimpoperationtilesource.c: minor cleanup. + + * app/gegl/gimpoperationtilesink.[ch]: add "data-written" signal + that is emitted whenever pixels have been written to the tile + manager. + 2007-12-30 Øyvind Kolås * app/core/Makefile.am: added GEGL_CFLAGS. diff --git a/app/gegl/gimpoperationtilesink.c b/app/gegl/gimpoperationtilesink.c index 507632a235..2d6f43a75c 100644 --- a/app/gegl/gimpoperationtilesink.c +++ b/app/gegl/gimpoperationtilesink.c @@ -34,6 +34,8 @@ #include "base/tile-manager.h" #include "base/pixel-region.h" +#include "core/gimpmarshal.h" + #include "gimp-gegl-utils.h" #include "gimpoperationtilesink.h" @@ -44,6 +46,12 @@ enum PROP_TILE_MANAGER }; +enum +{ + DATA_WRITTEN, + LAST_SIGNAL +}; + static void gimp_operation_tile_sink_finalize (GObject *object); static void gimp_operation_tile_sink_get_property (GObject *object, @@ -64,6 +72,8 @@ G_DEFINE_TYPE (GimpOperationTileSink, gimp_operation_tile_sink, #define parent_class gimp_operation_tile_sink_parent_class +static guint tile_sink_signals[LAST_SIGNAL] = { 0 }; + static void gimp_operation_tile_sink_class_init (GimpOperationTileSinkClass * klass) @@ -72,6 +82,16 @@ gimp_operation_tile_sink_class_init (GimpOperationTileSinkClass * klass) GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass); GeglOperationSinkClass *sink_class = GEGL_OPERATION_SINK_CLASS (klass); + tile_sink_signals[DATA_WRITTEN] = + g_signal_new ("data-written", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GimpOperationTileSinkClass, data_written), + NULL, NULL, + gimp_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + object_class->finalize = gimp_operation_tile_sink_finalize; object_class->set_property = gimp_operation_tile_sink_set_property; object_class->get_property = gimp_operation_tile_sink_get_property; @@ -166,19 +186,17 @@ gimp_operation_tile_sink_process (GeglOperation *operation, PixelRegion destPR; gpointer pr; - /* is this somethings that should be done already for all sinks? */ + extent = gegl_operation_result_rect (operation, context_id); + format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager)); + input = GEGL_BUFFER (gegl_operation_get_data (operation, context_id, "input")); - extent = gegl_operation_result_rect (operation, context_id); - pixel_region_init (&destPR, self->tile_manager, extent->x, extent->y, extent->width, extent->height, TRUE); - format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager)); - for (pr = pixel_regions_register (1, &destPR); pr; pr = pixel_regions_process (pr)) @@ -188,6 +206,9 @@ gimp_operation_tile_sink_process (GeglOperation *operation, gegl_buffer_get (input, 1.0, &rect, format, destPR.data, destPR.rowstride); } + + g_signal_emit (operation, tile_sink_signals[DATA_WRITTEN], 0, + extent); } else { diff --git a/app/gegl/gimpoperationtilesink.h b/app/gegl/gimpoperationtilesink.h index 872a46d2aa..de40ee79c7 100644 --- a/app/gegl/gimpoperationtilesink.h +++ b/app/gegl/gimpoperationtilesink.h @@ -44,6 +44,9 @@ struct _GimpOperationTileSink struct _GimpOperationTileSinkClass { GeglOperationSinkClass operation_sink_class; + + void (* data_written) (GimpOperationTileSink *sink, + const GeglRectangle *extent); }; diff --git a/app/gegl/gimpoperationtilesource.c b/app/gegl/gimpoperationtilesource.c index 0298072b74..16564fdd88 100644 --- a/app/gegl/gimpoperationtilesource.c +++ b/app/gegl/gimpoperationtilesource.c @@ -185,20 +185,20 @@ gimp_operation_tile_source_process (GeglOperation *operation, if (self->tile_manager) { - GeglBuffer *output; - const Babl *format; - PixelRegion srcPR; - gpointer pr; - const GeglRectangle *result; + GeglBuffer *output; + const Babl *format; + const GeglRectangle *extent; + PixelRegion srcPR; + gpointer pr; - result = gegl_operation_result_rect (operation, context_id); + extent = gegl_operation_result_rect (operation, context_id); format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager)); - output = gegl_buffer_new (result, format); + output = gegl_buffer_new (extent, format); pixel_region_init (&srcPR, self->tile_manager, - result->x, result->y, - result->width, result->height, + extent->x, extent->y, + extent->width, extent->height, FALSE); for (pr = pixel_regions_register (1, &srcPR);