mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 20:12:30 +00:00
minor cleanup.
2007-12-30 Michael Natterer <mitch@gimp.org> * 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
This commit is contained in:
parent
e84e383caa
commit
5adffe394a
|
@ -1,3 +1,11 @@
|
|||
2007-12-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* 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 <pippin@gimp.org>
|
||||
|
||||
* app/core/Makefile.am: added GEGL_CFLAGS.
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -44,6 +44,9 @@ struct _GimpOperationTileSink
|
|||
struct _GimpOperationTileSinkClass
|
||||
{
|
||||
GeglOperationSinkClass operation_sink_class;
|
||||
|
||||
void (* data_written) (GimpOperationTileSink *sink,
|
||||
const GeglRectangle *extent);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue