[gegl/threaded-base-classes] operation-composer3: bail earlier on 0x0 roi



commit c6a4c5833c2e7e44c290ec0217423be3779ad9ed
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Jun 24 05:42:51 2014 +0200

    operation-composer3: bail earlier on 0x0 roi

 gegl/operation/gegl-operation-composer3.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index 8130702..8cbda17 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -162,11 +162,14 @@ gegl_operation_composer3_process (GeglOperation        *operation,
       g_warning ("requested processing of %s pad on a composer", output_prop);
       return FALSE;
     }
+  output = gegl_operation_context_get_target (context, "output");
+
+  if (result->width == 0 || result->height == 0)
+    return TRUE;
 
   input = gegl_operation_context_get_source (context, "input");
   aux   = gegl_operation_context_get_source (context, "aux");
   aux2  = gegl_operation_context_get_source (context, "aux2");
-  output = gegl_operation_context_get_target (context, "output");
 
   /* A composer with a NULL aux, can still be valid, the
    * subclass has to handle it.
@@ -175,11 +178,11 @@ gegl_operation_composer3_process (GeglOperation        *operation,
       aux != NULL ||
       aux2 != NULL)
     {
+      gint threads = gegl_config ()->threads;
       op_class->parallelize = 1;
-      if (op_class->parallelize && result->width * result->height > 64*64)
+      if (threads > 1 && op_class->parallelize && result->width * result->height > 64*64)
       {
         GThreadPool *pool = thread_pool ();
-        gint threads = gegl_config ()->threads;
         ThreadData thread_data[GEGL_MAX_THREADS];
         gint pending = threads;
 


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