[gegl] buffer: s/gegl_tile_handler_chain_up/gegl_tile_handler_source_command/



commit d31273e36c6eab3d3fab6ce537f02d3f99a0d03d
Author: �yvind Kolås <pippin gimp org>
Date:   Tue Jul 20 20:19:44 2010 +0100

    buffer: s/gegl_tile_handler_chain_up/gegl_tile_handler_source_command/

 gegl/buffer/gegl-buffer.c             |    2 +-
 gegl/buffer/gegl-tile-handler-cache.c |   11 ++---------
 gegl/buffer/gegl-tile-handler-empty.c |    4 ++--
 gegl/buffer/gegl-tile-handler-log.c   |    2 +-
 gegl/buffer/gegl-tile-handler-zoom.c  |   21 +++++++++------------
 gegl/buffer/gegl-tile-handler.c       |    2 +-
 gegl/buffer/gegl-tile-handler.h       |    4 ++--
 gegl/buffer/gegl-tile-storage.c       |    2 +-
 8 files changed, 19 insertions(+), 29 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index d8cc450..44f6daa 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -743,7 +743,7 @@ gegl_buffer_command (GeglTileSource *source,
       case GEGL_TILE_GET:
         return gegl_buffer_get_tile (source, x, y, z);
       default:
-        return gegl_tile_handler_chain_up (handler, command, x, y, z, data);
+        return gegl_tile_handler_source_command (handler, command, x, y, z, data);
     }
 }
 
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index aae0e5a..212c866 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -148,13 +148,6 @@ static void        gegl_tile_handler_cache_invalidate (GeglTileHandlerCache *cac
                                                      gint              y,
                                                      gint              z);
 
-
-static void
-finalize (GObject *object)
-{
-  G_OBJECT_CLASS (gegl_tile_handler_cache_parent_class)->finalize (object);
-}
-
 static void
 gegl_tile_handler_cache_dispose_buffer_tiles (gpointer itm,
                                               gpointer userdata)
@@ -283,6 +276,7 @@ gegl_tile_handler_cache_command (GeglTileSource  *tile_store,
           gboolean action = gegl_tile_handler_cache_wash (cache);
           if (action)
             return GINT_TO_POINTER(action);
+          /* with no action, we chain up to lower levels */
           break;
         }
       case GEGL_TILE_REFETCH:
@@ -295,14 +289,13 @@ gegl_tile_handler_cache_command (GeglTileSource  *tile_store,
         break;
     }
 
-  return gegl_tile_handler_chain_up (handler, command, x, y, z, data);
+  return gegl_tile_handler_source_command (handler, command, x, y, z, data);
 }
 
 static void
 gegl_tile_handler_cache_class_init (GeglTileHandlerCacheClass *class)
 {
   GObjectClass        *gobject_class = G_OBJECT_CLASS (class);
-  gobject_class->finalize = finalize;
   gobject_class->dispose  = dispose;
 }
 
diff --git a/gegl/buffer/gegl-tile-handler-empty.c b/gegl/buffer/gegl-tile-handler-empty.c
index e0d8827..3409db9 100644
--- a/gegl/buffer/gegl-tile-handler-empty.c
+++ b/gegl/buffer/gegl-tile-handler-empty.c
@@ -75,13 +75,13 @@ gegl_tile_handler_empty_command (GeglTileSource  *buffer,
 {
   if (command == GEGL_TILE_GET)
     return get_tile (buffer, x, y, z);
-  return gegl_tile_handler_chain_up (buffer, command, x, y, z, data);
+  return gegl_tile_handler_source_command (buffer, command, x, y, z, data);
 }
 
 static void
 gegl_tile_handler_empty_class_init (GeglTileHandlerEmptyClass *klass)
 {
-  GObjectClass        *gobject_class = G_OBJECT_CLASS (klass);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->finalize     = finalize;
 }
 
diff --git a/gegl/buffer/gegl-tile-handler-log.c b/gegl/buffer/gegl-tile-handler-log.c
index ac6c581..b86442a 100644
--- a/gegl/buffer/gegl-tile-handler-log.c
+++ b/gegl/buffer/gegl-tile-handler-log.c
@@ -52,7 +52,7 @@ gegl_tile_handler_log_command (GeglTileSource  *gegl_tile_source,
   GeglTileHandler *handler = GEGL_HANDLER (gegl_tile_source);
   gpointer         result = NULL;
 
-  result = gegl_tile_handler_chain_up (handler, command, x, y, z, data);
+  result = gegl_tile_handler_source_command (handler, command, x, y, z, data);
 
   switch (command)
     {
diff --git a/gegl/buffer/gegl-tile-handler-zoom.c b/gegl/buffer/gegl-tile-handler-zoom.c
index 6edd6c1..442a953 100644
--- a/gegl/buffer/gegl-tile-handler-zoom.c
+++ b/gegl/buffer/gegl-tile-handler-zoom.c
@@ -295,18 +295,13 @@ gegl_tile_handler_zoom_command (GeglTileSource  *tile_store,
                                 gint             y,
                                 gint             z,
                                 gpointer         data)
-  {
-  GeglTileHandler *handler  = GEGL_HANDLER (tile_store);
-  /*GeglTileSource *source = handler->source;*/
+{
+  GeglTileHandler *handler  = (void*)tile_store;
 
-  switch (command)
-    {
-      case GEGL_TILE_GET:
-        return get_tile (tile_store, x, y, z);
-      default:
-        /* pass the command on */
-        return gegl_tile_handler_chain_up (handler, command, x, y, z, data);
-    }
+  if (command == GEGL_TILE_GET)
+    return get_tile (tile_store, x, y, z);
+  else
+    return gegl_tile_handler_source_command (handler, command, x, y, z, data);
 }
 
 static void
@@ -327,7 +322,9 @@ 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;
+  ret = g_malloc0 (sizeof (GeglTileHandlerZoom));
+  ((GeglTileSource*)ret)->command = gegl_tile_handler_zoom_command;
   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 12b6c06..175bae2 100644
--- a/gegl/buffer/gegl-tile-handler.c
+++ b/gegl/buffer/gegl-tile-handler.c
@@ -59,7 +59,7 @@ gegl_tile_handler_command (GeglTileSource *gegl_tile_source,
 {
   GeglTileHandler *handler = (GeglTileHandler*)gegl_tile_source;
 
-  return gegl_tile_handler_chain_up (handler, command, x, y, z, data);
+  return gegl_tile_handler_source_command (handler, command, x, y, z, data);
 }
 
 static void
diff --git a/gegl/buffer/gegl-tile-handler.h b/gegl/buffer/gegl-tile-handler.h
index 5b92f30..e248d97 100644
--- a/gegl/buffer/gegl-tile-handler.h
+++ b/gegl/buffer/gegl-tile-handler.h
@@ -35,7 +35,7 @@ struct _GeglTileHandler
   GeglTileSource  parent_instance;
   GeglTileSource *source; /* The source of the data, which we can rely on if
                              our command handler doesn't handle a command, this
-                             is typically done with gegl_tile_handler_chain_up
+                             is typically done with gegl_tile_handler_source_command
                              passing ourself as the first parameter. */
 };
 
@@ -53,7 +53,7 @@ gegl_tile_handler_set_source (GeglTileHandler *handler,
 
 #define gegl_tile_handler_get_source(handler)  (((GeglTileHandler*)handler)->source)
 
-#define gegl_tile_handler_chain_up(handler,command,x,y,z,data) (gegl_tile_handler_get_source(handler)?gegl_tile_source_command(gegl_tile_handler_get_source(handler), command, x, y, z, data):NULL)
+#define gegl_tile_handler_source_command(handler,command,x,y,z,data) (gegl_tile_handler_get_source(handler)?gegl_tile_source_command(gegl_tile_handler_get_source(handler), command, x, y, z, data):NULL)
 
 
 G_END_DECLS
diff --git a/gegl/buffer/gegl-tile-storage.c b/gegl/buffer/gegl-tile-storage.c
index 2691b32..af951c1 100644
--- a/gegl/buffer/gegl-tile-storage.c
+++ b/gegl/buffer/gegl-tile-storage.c
@@ -149,7 +149,7 @@ gegl_tile_storage_new (gint tile_width,
                       g_object_new (GEGL_TYPE_TILE_HANDLER_LOG, NULL));
 #endif
 
-  cache = gegl_tile_handler_cache_new ();
+  cache = g_object_new (GEGL_TYPE_TILE_HANDLER_CACHE, NULL);
   empty = gegl_tile_handler_empty_new (backend, cache);
   zoom = gegl_tile_handler_zoom_new (backend, tile_storage, cache);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]