[gimp/goat-invasion: 27/608] app: make projection use GeglBuffers



commit 961b632a7e0fee48ea8fab13a1595da8d2f2276a
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Wed Mar 14 20:16:58 2012 +0000

    app: make projection use GeglBuffers

 app/core/gimpprojection.c |   37 +++++++++++++++++++++++++++++++------
 1 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 54c7623..ca6dc94 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -18,6 +18,7 @@
 #include "config.h"
 
 #include <gegl.h>
+#include <gegl-buffer-backend.h>
 
 #include "core-types.h"
 
@@ -27,6 +28,8 @@
 #include "base/tile-manager.h"
 #include "base/tile-pyramid.h"
 
+#include "gegl/gimp-gegl-utils.h"
+
 #include "gimp.h"
 #include "gimparea.h"
 #include "gimpimage.h"
@@ -372,6 +375,8 @@ GeglNode *
 gimp_projection_get_sink_node (GimpProjection *proj)
 {
   GeglNode *graph;
+  GeglBuffer *buffer;
+  TileManager *tiles;
 
   g_return_val_if_fail (GIMP_IS_PROJECTION (proj), NULL);
 
@@ -387,12 +392,15 @@ gimp_projection_get_sink_node (GimpProjection *proj)
   graph = gimp_projectable_get_graph (proj->projectable);
   gegl_node_add_child (proj->graph, graph);
 
+  tiles  = gimp_projection_get_tiles (GIMP_PICKABLE (proj));
+  buffer = gimp_tile_manager_get_gegl_buffer (tiles, TRUE);
+
   proj->sink_node =
     gegl_node_new_child (proj->graph,
-                         "operation",    "gimp:tilemanager-sink",
-                         "tile-manager", gimp_projection_get_tiles (GIMP_PICKABLE (proj)),
-                         "linear",       TRUE,
+                         "operation",    "gegl:write-buffer",
+                         "buffer", buffer,
                          NULL);
+  g_object_unref (buffer);
 
   gegl_node_connect_to (graph,           "output",
                         proj->sink_node, "input");
@@ -424,11 +432,16 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
 
       if (proj->sink_node)
         {
-          TileManager *tiles = tile_pyramid_get_tiles (proj->pyramid, 0, NULL);
+          TileManager *tiles;
+          GeglBuffer *buffer;
+          tiles = tile_pyramid_get_tiles (proj->pyramid, 0, NULL);
+          buffer = gimp_tile_manager_get_gegl_buffer (tiles, TRUE);
 
           gegl_node_set (proj->sink_node,
-                         "tile-manager", tiles,
+                         "buffer", buffer,
                          NULL);
+
+          g_object_unref (buffer);
         }
     }
 
@@ -762,7 +775,19 @@ gimp_projection_invalidate (GimpProjection *proj,
                             guint           h)
 {
   if (proj->pyramid)
-    tile_pyramid_invalidate_area (proj->pyramid, x, y, w, h);
+    {
+      if (proj->sink_node)
+        {
+          GeglBuffer *buffer;
+          gegl_node_get (proj->sink_node, "buffer", &buffer, NULL);
+
+          /* makes the buffer drop all GimpTiles */
+          gegl_tile_source_reinit ((void*)buffer);
+          g_object_unref (buffer);
+        }
+
+      tile_pyramid_invalidate_area (proj->pyramid, x, y, w, h);
+    }
 }
 
 static void



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