[gegl/soc-2012-ops] buffer: add preliminary gegl_buffer_add, remove_handler()
- From: Maxime Nicco <maxnicco src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2012-ops] buffer: add preliminary gegl_buffer_add, remove_handler()
- Date: Wed, 11 Jul 2012 18:30:02 +0000 (UTC)
commit f6f81d9a35045a94eade3bc18ed1c87128fca241
Author: Michael Natterer <mitch gimp org>
Date: Thu Jul 5 21:33:18 2012 +0200
buffer: add preliminary gegl_buffer_add,remove_handler()
mostly for discussion and getting the GIMP projection patch
some public testing.
NOTE: this API will change.
gegl/buffer/gegl-buffer.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
gegl/buffer/gegl-buffer.h | 5 +++++
2 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index c3e1c6b..dc71186 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -1090,6 +1090,50 @@ gegl_buffer_new_for_backend (const GeglRectangle *extent,
NULL);
}
+void
+gegl_buffer_add_handler (GeglBuffer *buffer,
+ gpointer handler)
+{
+ GeglTileHandlerChain *chain;
+
+ g_return_if_fail (GEGL_IS_BUFFER (buffer));
+ g_return_if_fail (GEGL_IS_TILE_HANDLER (handler));
+
+ g_object_set (handler,
+ "format", buffer->tile_storage->format,
+ "tile-width", buffer->tile_storage->tile_width,
+ "tile-height", buffer->tile_storage->tile_height,
+ NULL);
+
+ chain = GEGL_TILE_HANDLER_CHAIN (buffer->tile_storage);
+
+ gegl_tile_handler_chain_add (chain, handler);
+
+ /* XXX */
+ chain->chain = g_slist_remove (chain->chain, handler);
+ chain->chain = g_slist_insert (chain->chain, handler, 2);
+
+ gegl_tile_handler_chain_bind (chain);
+}
+
+void
+gegl_buffer_remove_handler (GeglBuffer *buffer,
+ gpointer handler)
+{
+ GeglTileHandlerChain *chain;
+
+ g_return_if_fail (GEGL_IS_BUFFER (buffer));
+ g_return_if_fail (GEGL_IS_TILE_HANDLER (handler));
+
+ chain = GEGL_TILE_HANDLER_CHAIN (buffer->tile_storage);
+
+ g_return_if_fail (g_slist_find (chain->chain, handler));
+
+ chain->chain = g_slist_remove (chain->chain, handler);
+ g_object_unref (handler);
+
+ gegl_tile_handler_chain_bind (chain);
+}
/* FIXME: this function needs optimizing, perhaps keep a pool
* of GeglBuffer shells that can be adapted to the needs
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index c35dfa6..32d2e1a 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -77,6 +77,11 @@ GeglBuffer * gegl_buffer_new (const GeglRectangle *extent,
GeglBuffer * gegl_buffer_new_for_backend (const GeglRectangle *extent,
void *backend);
+void gegl_buffer_add_handler (GeglBuffer *buffer,
+ gpointer handler);
+void gegl_buffer_remove_handler (GeglBuffer *buffer,
+ gpointer handler);
+
/**
* gegl_buffer_open:
* @path: the path to a gegl buffer on disk.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]