[gegl] buffer: GEGL_LINEAR_BUFFERS environment variable controlling temp buffers



commit e012437d654d8a842e9a817249ae64641b35e9ac
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Jun 1 19:38:30 2014 +0200

    buffer: GEGL_LINEAR_BUFFERS environment variable controlling temp buffers
    
    If this environment variable is set, temporary buffers used will be linear
    buffers the size of roi, in many cases this could cause a single ::process()
    per op in the graph.
    
    Optional for now; might become default behavior.

 gegl/operation/gegl-operation-context.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-context.c b/gegl/operation/gegl-operation-context.c
index 84258f4..6b903a5 100644
--- a/gegl/operation/gegl-operation-context.c
+++ b/gegl/operation/gegl-operation-context.c
@@ -294,11 +294,15 @@ gegl_operation_context_get_target (GeglOperationContext *context,
   const Babl          *format;
   GeglNode            *node;
   GeglOperation       *operation;
+  static gint          linear_buffers = -1;
 
 #if 0
   g_return_val_if_fail (GEGL_IS_OPERATION_CONTEXT (context), NULL);
 #endif
 
+  if (linear_buffers == -1)
+    linear_buffers = getenv ("GEGL_LINEAR_BUFFERS")?1:0;
+
   operation = context->operation;
   node = operation->node; /* <ick */
   format = gegl_operation_get_format (operation, padname);
@@ -317,7 +321,10 @@ gegl_operation_context_get_target (GeglOperationContext *context,
   if (result->width == 0 ||
       result->height == 0)
     {
-      output = gegl_buffer_new (GEGL_RECTANGLE (0, 0, 0, 0), format);
+      if (linear_buffers)
+        output = gegl_buffer_linear_new (GEGL_RECTANGLE(0, 0, 0, 0), format);
+      else
+        output = gegl_buffer_new (GEGL_RECTANGLE (0, 0, 0, 0), format);
     }
   else if (node->dont_cache == FALSE &&
       ! GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
@@ -335,12 +342,18 @@ gegl_operation_context_get_target (GeglOperationContext *context,
         }
       else
         {
-          output = gegl_buffer_new (result, format);
+          if (linear_buffers)
+            output = gegl_buffer_linear_new (result, format);
+          else
+            output = gegl_buffer_new (result, format);
         }
     }
   else
     {
-      output = gegl_buffer_new (result, format);
+      if (linear_buffers)
+        output = gegl_buffer_linear_new (result, format);
+      else
+        output = gegl_buffer_new (result, format);
     }
 
   gegl_operation_context_take_object (context, padname, G_OBJECT (output));


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