[gegl] Clean up some GeglBuffer functions



commit f7ecd7e1f688acf0f38eaa74c323bc67c569ec11
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Wed Jan 22 14:54:53 2014 -0800

    Clean up some GeglBuffer functions

 gegl/buffer/gegl-buffer-access.c  |   10 ++--------
 gegl/buffer/gegl-buffer-private.h |    2 +-
 gegl/buffer/gegl-buffer.c         |   28 +++++++---------------------
 3 files changed, 10 insertions(+), 30 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index cb90999..43775b5 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1453,14 +1453,8 @@ gegl_buffer_copy (GeglBuffer          *src,
            */
           {
             /* first we do a dumb copy,. but with fetched tiles */
-
+            GeglTileHandlerCache *cache = dst->tile_storage->cache;
             gint dst_x, dst_y;
-            GeglTileHandlerChain   *storage;
-            GeglTileHandlerCache   *cache;
-
-            storage = GEGL_TILE_HANDLER_CHAIN (dst->tile_storage);
-            cache = GEGL_TILE_HANDLER_CACHE (gegl_tile_handler_chain_get_first (storage, 
GEGL_TYPE_TILE_HANDLER_CACHE));
-
 
             for (dst_y = cow_rect.y + dst->shift_y; dst_y < cow_rect.y + dst->shift_y + cow_rect.height; 
dst_y += tile_height)
             for (dst_x = cow_rect.x + dst->shift_x; dst_x < cow_rect.x + dst->shift_x + cow_rect.width; 
dst_x += tile_width)
@@ -1482,7 +1476,7 @@ gegl_buffer_copy (GeglBuffer          *src,
                                                       stx, sty, 0);
 
                 dst_tile = gegl_tile_dup (src_tile);
-                dst_tile->tile_storage = (void*)storage;
+                dst_tile->tile_storage = dst->tile_storage;
                 dst_tile->x = dtx;
                 dst_tile->y = dty;
                 dst_tile->z = 0;
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index 95d4ef7..635cd08 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -72,7 +72,7 @@ struct _GeglBuffer
                                           useful for debugging */
   gint              alloc_stack_size;
 
-  gpointer          backend;
+  GeglTileBackend  *backend;
 };
 
 struct _GeglBufferClass
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index 743acbd..26a07e9 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -461,19 +461,8 @@ gegl_buffer_backend2 (GeglBuffer *buffer)
 {
   GeglTileSource *tmp = GEGL_TILE_SOURCE (buffer);
 
-  if (!tmp)
-    return NULL;
-
-  do
-    {
-      tmp = GEGL_TILE_HANDLER (tmp)->source;
-    }
-  while (tmp &&
-         !GEGL_IS_TILE_BACKEND (tmp));
-
-  if (!tmp &&
-      !GEGL_IS_TILE_BACKEND (tmp))
-    return NULL;
+  while (tmp && !GEGL_IS_TILE_BACKEND (tmp))
+    tmp = GEGL_TILE_HANDLER (tmp)->source;
 
   return (GeglTileBackend *) tmp;
 }
@@ -497,15 +486,12 @@ gegl_buffer_backend (GeglBuffer *buffer)
 static GeglTileStorage *
 gegl_buffer_tile_storage (GeglBuffer *buffer)
 {
-  GeglTileSource *tmp = (GeglTileSource*) buffer;
+  GeglTileSource *tmp = GEGL_TILE_SOURCE (buffer);
 
-  do
-    {
-      tmp = ((GeglTileHandler *) (tmp))->source;
-    }
-  while (!GEGL_IS_TILE_STORAGE (tmp));
+  while (tmp && !GEGL_IS_TILE_STORAGE (tmp))
+    tmp = GEGL_TILE_HANDLER (tmp)->source;
 
-  g_assert (tmp);
+  g_warn_if_fail (tmp);
 
   return (GeglTileStorage *) tmp;
 }
@@ -515,7 +501,7 @@ gegl_buffer_storage_changed (GeglTileStorage     *storage,
                              const GeglRectangle *rect,
                              gpointer             userdata)
 {
-  g_signal_emit_by_name (GEGL_BUFFER (userdata), "changed", rect, NULL);
+  gegl_buffer_emit_changed_signal (GEGL_BUFFER (userdata), rect);
 }
 
 static GObject *


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