[gegl/soc-2011-warp: 9/20] gegl_buffer_dup: use the cache to insert duplicated tiles



commit ec51ccae449fb44613bfd8e020f6d6cf8ae34a6c
Author: Michael Murà <batolettre gmail com>
Date:   Thu Jul 28 14:49:33 2011 +0200

    gegl_buffer_dup: use the cache to insert duplicated tiles

 gegl/buffer/gegl-buffer-access.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 1f4e06e..b840309 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -38,6 +38,7 @@
 #include "gegl-sampler-lohalo.h"
 #include "gegl-buffer-index.h"
 #include "gegl-tile-backend.h"
+#include "gegl-tile-handler-chain.h"
 #include "gegl-buffer-iterator.h"
 
 #if 0
@@ -1277,28 +1278,28 @@ gegl_buffer_dup (GeglBuffer *buffer)
   GeglBuffer             *new_buffer;
   GeglBufferTileIterator  it;
   GeglRectangle           extent;
-  GeglTileSource         *tile_source;
+  GeglTileHandlerChain   *storage;
+  GeglTileHandlerCache   *cache;
 
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
 
   new_buffer = gegl_buffer_new (gegl_buffer_get_extent (buffer), buffer->format);
-  tile_source = GEGL_TILE_SOURCE (new_buffer);
 
   extent = *gegl_buffer_get_extent (buffer);
 
   gegl_buffer_tile_iterator_init (&it, buffer, extent, FALSE);
 
+  storage = GEGL_TILE_HANDLER_CHAIN (new_buffer->tile_storage);
+  cache = GEGL_TILE_HANDLER_CACHE (gegl_tile_handler_chain_get_first (storage, GEGL_TYPE_TILE_HANDLER_CACHE));
+
+
   while (gegl_buffer_tile_iterator_next (&it))
     {
       GeglTile *tile;
-      gboolean  success;
 
       tile = gegl_tile_dup (it.tile);
 
-      success = gegl_tile_source_set_tile (tile_source, tile->x, tile->y, tile->z, tile);
-
-      if (!success)
-        g_print ("Error in inserting the copy on write dupplicated tile.");
+      gegl_tile_handler_cache_insert (cache, tile, tile->x, tile->y, tile->z);
     }
 
   return new_buffer;



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