[gegl] gegl: move cache's set_extent from gegl_node_get_bounding_box



commit 71b4598e1f6f5fc2e3115f2cf18a18d217c5d876
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sat Dec 1 18:51:54 2012 +0100

    gegl: move cache's set_extent from gegl_node_get_bounding_box
    
    to gegl_have_visitor_visit_node which is called by the former.
    This way the cache buffer is resized also after a graph invalidation
    
    This avoids the artifacts that used to appear in gimp-2.9
    around a layer after downscaling it.

 gegl/graph/gegl-node.c           |    4 ----
 gegl/process/gegl-have-visitor.c |    7 +++++++
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index f3aa3b6..32878da 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -1768,10 +1768,6 @@ gegl_node_get_bounding_box (GeglNode *root)
   g_object_unref (root);
   g_free (id);
 
-  if (root->cache)
-    gegl_buffer_set_extent (GEGL_BUFFER (root->cache), &root->have_rect);
-
-  root->valid_have_rect = TRUE;
   return root->have_rect;
 }
 
diff --git a/gegl/process/gegl-have-visitor.c b/gegl/process/gegl-have-visitor.c
index 6c32435..2619351 100644
--- a/gegl/process/gegl-have-visitor.c
+++ b/gegl/process/gegl-have-visitor.c
@@ -66,6 +66,13 @@ gegl_have_visitor_visit_node (GeglVisitor *self,
   operation = node->operation;
   g_mutex_lock (node->mutex);
   node->have_rect = gegl_operation_get_bounding_box (operation);
+  /*
+   * Setting cache dimensions here helps in case of node
+   *  invalidation that reduce the bounding box of the operation
+   */
+  if (node->cache)
+    gegl_buffer_set_extent (GEGL_BUFFER (node->cache), &node->have_rect);
+  node->valid_have_rect = TRUE;
 
   GEGL_NOTE (GEGL_DEBUG_PROCESS,
              "For \"%s\" have_rect = %d,%d %dÃ%d",



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