[gegl] gegl: Set the cache on the operation context during evaluation



commit 4c02060d3007378a4097f5439a32affcf58e2d71
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Jun 21 18:25:48 2009 +0200

    gegl: Set the cache on the operation context during evaluation
    
    Set the cache on the operation context during pad evaluation instead
    of during the need rect calculation phase. It simply feels more clean
    this way.

 gegl/operation/gegl-operations.c |    4 ----
 gegl/process/gegl-eval-visitor.c |   13 ++++++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/gegl/operation/gegl-operations.c b/gegl/operation/gegl-operations.c
index dc8f06a..b93a936 100644
--- a/gegl/operation/gegl-operations.c
+++ b/gegl/operation/gegl-operations.c
@@ -186,10 +186,6 @@ gegl_operation_set_need_rect (GeglOperation       *operation,
             {
               child_context->result_rect = child_need;
               child_context->cached = TRUE;
-              g_object_ref (cache);
-              gegl_operation_context_take_object (child_context,
-                                                  gegl_pad_get_name (output_pad),
-                                                  G_OBJECT (cache));
               child_need.width = 0;
               child_need.height = 0;
             }
diff --git a/gegl/process/gegl-eval-visitor.c b/gegl/process/gegl-eval-visitor.c
index dc00bc3..825285b 100644
--- a/gegl/process/gegl-eval-visitor.c
+++ b/gegl/process/gegl-eval-visitor.c
@@ -73,7 +73,14 @@ gegl_eval_visitor_visit_pad (GeglVisitor *self,
   if (gegl_pad_is_output (pad))
     {
       /* processing only really happens for output pads */
-      if (!context->cached)
+      if (context->cached)
+        {
+          GEGL_NOTE (GEGL_DEBUG_PROCESS, "Using cache for pad '%s' on \"%s\"", gegl_pad_get_name (pad), gegl_node_get_debug_name (node));
+          gegl_operation_context_set_object (context,
+                                             gegl_pad_get_name (pad),
+                                             G_OBJECT (node->cache));
+        }
+      else
         {
           glong time      = gegl_ticks ();
           glong babl_time = babl_total_usecs;
@@ -96,10 +103,6 @@ gegl_eval_visitor_visit_pad (GeglVisitor *self,
               gegl_cache_computed (node->cache, &context->result_rect);
             }
         }
-      else
-        {
-          GEGL_NOTE (GEGL_DEBUG_PROCESS, "Using cache for pad '%s' on \"%s\"", gegl_pad_get_name (pad), gegl_node_get_debug_name (node));
-        }
     }
   else if (gegl_pad_is_input (pad))
     {



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