[gegl] buffer: simplified buffer construction logic
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: simplified buffer construction logic
- Date: Tue, 20 Jul 2010 20:35:35 +0000 (UTC)
commit d3edd1adccc31c63c26773253a3263aa85530e18
Author: �yvind Kolås <pippin gimp org>
Date: Tue Jul 20 02:43:54 2010 +0100
buffer: simplified buffer construction logic
gegl/buffer/gegl-tile-handler-empty.c | 13 +++----------
gegl/buffer/gegl-tile-handler-zoom.c | 7 +++----
gegl/buffer/gegl-tile-handler.c | 14 --------------
gegl/buffer/gegl-tile-source.h | 16 ++++++++--------
gegl/buffer/gegl-tile-storage.c | 11 +++++++++++
5 files changed, 25 insertions(+), 36 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-handler-empty.c b/gegl/buffer/gegl-tile-handler-empty.c
index 56b8b08..e0d8827 100644
--- a/gegl/buffer/gegl-tile-handler-empty.c
+++ b/gegl/buffer/gegl-tile-handler-empty.c
@@ -23,6 +23,7 @@
#include "gegl-tile-handler.h"
#include "gegl-tile-handler-empty.h"
#include "gegl-tile-handler-cache.h"
+#include "gegl-tile-backend.h"
G_DEFINE_TYPE (GeglTileHandlerEmpty, gegl_tile_handler_empty, GEGL_TYPE_TILE_HANDLER)
@@ -95,17 +96,9 @@ gegl_tile_handler_empty_new (GeglTileBackend *backend,
GeglTileHandlerCache *cache)
{
GeglTileHandlerEmpty *empty = g_object_new (GEGL_TYPE_TILE_HANDLER_EMPTY, NULL);
- gint tile_width, tile_height, tile_size;
empty->backend = backend;
empty->cache = cache;
-
- g_object_get (empty->backend, "tile-width", &tile_width,
- "tile-height", &tile_height,
- "tile-size", &tile_size,
- NULL);
- /* FIXME: need babl format here */
- empty->tile = gegl_tile_new (tile_size);
- memset (gegl_tile_get_data (empty->tile), 0x00, tile_size);
-
+ empty->tile = gegl_tile_new (backend->tile_size);
+ memset (gegl_tile_get_data (empty->tile), 0x00, backend->tile_size);
return (void*)empty;
}
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index 81f1c5c..6edd6c1 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -197,8 +197,8 @@ get_tile (GeglTileSource *gegl_tile_source,
gint y,
gint z)
{
- GeglTileSource *source = GEGL_HANDLER (gegl_tile_source)->source;
- GeglTileHandlerZoom *zoom = GEGL_TILE_HANDLER_ZOOM (gegl_tile_source);
+ GeglTileSource *source = ((GeglTileHandler*)(gegl_tile_source))->source;
+ GeglTileHandlerZoom *zoom = (GeglTileHandlerZoom*)(gegl_tile_source);
GeglTile *tile = NULL;
Babl *format = (Babl *) (zoom->backend->format);
gint tile_width;
@@ -327,8 +327,7 @@ gegl_tile_handler_zoom_new (GeglTileBackend *backend,
GeglTileStorage *tile_storage,
GeglTileHandlerCache *cache)
{
- GeglTileHandlerZoom *ret = g_object_new (GEGL_TYPE_TILE_HANDLER_ZOOM,
- NULL);
+ GeglTileHandlerZoom *ret = g_object_new (GEGL_TYPE_TILE_HANDLER_ZOOM, NULL);
ret->backend = backend;
ret->tile_storage = tile_storage;
ret->cache = cache;
diff --git a/gegl/buffer/gegl-tile-handler.c b/gegl/buffer/gegl-tile-handler.c
index 7943c29..12b6c06 100644
--- a/gegl/buffer/gegl-tile-handler.c
+++ b/gegl/buffer/gegl-tile-handler.c
@@ -96,20 +96,6 @@ gegl_tile_handler_set_source (GeglTileHandler *handler,
}
handler->source = g_object_ref (source);
- /* special case if we are the Traits subclass of Trait
- * also set the source at the end of the chain.
- */
- if (GEGL_IS_TILE_HANDLER_CHAIN (handler))
- {
- GeglTileHandlerChain *tile_handler_chain = GEGL_TILE_HANDLER_CHAIN (handler);
- GSList *iter = (void *) tile_handler_chain->chain;
- while (iter && iter->next)
- iter = iter->next;
- if (iter)
- {
- gegl_tile_handler_set_source (GEGL_HANDLER (iter->data), handler->source);
- }
- }
}
static void
diff --git a/gegl/buffer/gegl-tile-source.h b/gegl/buffer/gegl-tile-source.h
index 96d4160..85c6a5a 100644
--- a/gegl/buffer/gegl-tile-source.h
+++ b/gegl/buffer/gegl-tile-source.h
@@ -37,13 +37,13 @@ typedef gint GeglTileCommand;
struct _GeglTileSource
{
- GObject parent_instance;
- gpointer (*command) (GeglTileSource *gegl_tile_source,
- GeglTileCommand command,
- gint x,
- gint y,
- gint z,
- gpointer data);
+ GObject parent_instance;
+ gpointer (*command) (GeglTileSource *gegl_tile_source,
+ GeglTileCommand command,
+ gint x,
+ gint y,
+ gint z,
+ gpointer data);
};
struct _GeglTileSourceClass
@@ -178,7 +178,7 @@ gboolean gegl_tile_source_idle (GeglTileSource *source);
#endif
#define gegl_tile_source_command(source,cmd,x,y,z,tile)\
-(GEGL_TILE_SOURCE(source)->command(source,cmd,x,y,z,tile))
+(((GeglTileSource*)(source))->command(source,cmd,x,y,z,tile))
#define gegl_tile_source_set_tile(source,x,y,z,tile) \
(gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_SET,x,y,z,tile))
diff --git a/gegl/buffer/gegl-tile-storage.c b/gegl/buffer/gegl-tile-storage.c
index 02c6c32..8cfe362 100644
--- a/gegl/buffer/gegl-tile-storage.c
+++ b/gegl/buffer/gegl-tile-storage.c
@@ -227,6 +227,17 @@ gegl_tile_storage_constructor (GType type,
tile_storage->tile_size = backend->tile_size;
tile_storage->px_size = backend->px_size;
gegl_tile_handler_set_source (handler, (void*)backend);
+ { /* should perhaps be a.. method on gegl_tile_handler_chain_set_source
+ wrapping handler_set_source() and this*/
+ GeglTileHandlerChain *tile_handler_chain = GEGL_TILE_HANDLER_CHAIN (handler);
+ GSList *iter = (void *) tile_handler_chain->chain;
+ while (iter && iter->next)
+ iter = iter->next;
+ if (iter)
+ {
+ gegl_tile_handler_set_source (GEGL_HANDLER (iter->data), handler->source);
+ }
+ }
g_object_unref (handler->source); /* eeek */
backend = GEGL_TILE_BACKEND (handler->source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]