[gegl] gegl: Don't assume cache is always used



commit a3907b441b1f4bd167be85c2ffa90bb3018e9ad6
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Jun 21 18:40:21 2009 +0200

    gegl: Don't assume cache is always used
    
    In gegl_eval_visitor_visit_pad() we can not always assume that the
    cache has been used as the output buffer, so move this logic to all
    users of gegl_operation_context_get_target() instead, and only call
    gegl_cache_computed() if it actually was the cache that _was_ the
    output buffer.
    
    This is admittely not a good looking way of doing this, but it is
    another sign that the current caching strategy and maybe even graph
    evaluation strategy might need to be redesigned.

 gegl/operation/gegl-operation-composer.c        |    4 ++++
 gegl/operation/gegl-operation-composer3.c       |    4 ++++
 gegl/operation/gegl-operation-filter.c          |    4 ++++
 gegl/operation/gegl-operation-point-composer.c  |    3 +++
 gegl/operation/gegl-operation-point-composer3.c |    3 +++
 gegl/operation/gegl-operation-source.c          |    3 +++
 gegl/process/gegl-eval-visitor.c                |    8 --------
 7 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer.c b/gegl/operation/gegl-operation-composer.c
index aa54bd0..c98281a 100644
--- a/gegl/operation/gegl-operation-composer.c
+++ b/gegl/operation/gegl-operation-composer.c
@@ -172,6 +172,10 @@ gegl_operation_composer_process (GeglOperation       *operation,
       aux != NULL)
     {
       success = klass->process (operation, input, aux, output, result);
+
+      if (output == GEGL_BUFFER (operation->node->cache))
+        gegl_cache_computed (operation->node->cache, result);
+
       if (input)
         g_object_unref (input);
       if (aux)
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index 2dc7d5c..73bdf04 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -189,6 +189,10 @@ gegl_operation_composer3_process (GeglOperation        *operation,
       aux2 != NULL)
     {
       success = klass->process (operation, input, aux, aux2, output, result);
+
+      if (output == GEGL_BUFFER (operation->node->cache))
+        gegl_cache_computed (operation->node->cache, result);
+
       if (input)
         g_object_unref (input);
       if (aux)
diff --git a/gegl/operation/gegl-operation-filter.c b/gegl/operation/gegl-operation-filter.c
index bac5c8e..d0341c4 100644
--- a/gegl/operation/gegl-operation-filter.c
+++ b/gegl/operation/gegl-operation-filter.c
@@ -206,6 +206,10 @@ gegl_operation_filter_process (GeglOperation   *operation,
   output = gegl_operation_context_get_target (context, "output");
     {
       success = klass->process (operation, input, output, result);
+
+      if (output == GEGL_BUFFER (operation->node->cache))
+        gegl_cache_computed (operation->node->cache, result);
+
       if (input != NULL)
         g_object_unref (input);
     }
diff --git a/gegl/operation/gegl-operation-point-composer.c b/gegl/operation/gegl-operation-point-composer.c
index 32561ba..b9e477d 100644
--- a/gegl/operation/gegl-operation-point-composer.c
+++ b/gegl/operation/gegl-operation-point-composer.c
@@ -173,6 +173,9 @@ gegl_operation_composer_process2 (GeglOperation       *operation,
       if (!done)
         {
           success = klass->process (operation, input, aux, output, result);
+
+          if (output == GEGL_BUFFER (operation->node->cache))
+            gegl_cache_computed (operation->node->cache, result);
         }
       if (input)
          g_object_unref (input);
diff --git a/gegl/operation/gegl-operation-point-composer3.c b/gegl/operation/gegl-operation-point-composer3.c
index 73673b6..904045b 100644
--- a/gegl/operation/gegl-operation-point-composer3.c
+++ b/gegl/operation/gegl-operation-point-composer3.c
@@ -120,6 +120,9 @@ gegl_operation_composer3_process2 (GeglOperation        *operation,
       if (!done)
         {
           success = klass->process (operation, input, aux, aux2, output, result);
+
+          if (output == GEGL_BUFFER (operation->node->cache))
+            gegl_cache_computed (operation->node->cache, result);
         }
       if (input)
          g_object_unref (input);
diff --git a/gegl/operation/gegl-operation-source.c b/gegl/operation/gegl-operation-source.c
index 4b2d250..8e830b7 100644
--- a/gegl/operation/gegl-operation-source.c
+++ b/gegl/operation/gegl-operation-source.c
@@ -139,6 +139,9 @@ gegl_operation_source_process (GeglOperation       *operation,
   output = gegl_operation_context_get_target (context, "output");
   success = klass->process (operation, output, result);
 
+  if (output == GEGL_BUFFER (operation->node->cache))
+    gegl_cache_computed (operation->node->cache, result);
+
   return success;
 }
 
diff --git a/gegl/process/gegl-eval-visitor.c b/gegl/process/gegl-eval-visitor.c
index 825285b..92f83af 100644
--- a/gegl/process/gegl-eval-visitor.c
+++ b/gegl/process/gegl-eval-visitor.c
@@ -94,14 +94,6 @@ gegl_eval_visitor_visit_pad (GeglVisitor *self,
 
           gegl_instrument ("process", gegl_node_get_operation (node), time);
           gegl_instrument (gegl_node_get_operation (node), "babl", babl_time);
-
-          if (node->cache)
-            {
-              /* if we've got a cache, notify the cache that parts
-               * of it has been computed
-               */
-              gegl_cache_computed (node->cache, &context->result_rect);
-            }
         }
     }
   else if (gegl_pad_is_input (pad))



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