[gimp] app: enable the fast path again in GimpOperationNormalMode



commit 3a0daf540a877ab75299f600524474f31f72f4f7
Author: Michael Natterer <mitch gimp org>
Date:   Mon Mar 11 15:38:28 2013 +0100

    app: enable the fast path again in GimpOperationNormalMode
    
    but fix it to not take the fast path if opacity is != 1.0 or there is
    a mask.

 app/operations/gimpoperationnormalmode.c |   68 +++++++++++++++--------------
 1 files changed, 35 insertions(+), 33 deletions(-)
---
diff --git a/app/operations/gimpoperationnormalmode.c b/app/operations/gimpoperationnormalmode.c
index 11f3075..0e263be 100644
--- a/app/operations/gimpoperationnormalmode.c
+++ b/app/operations/gimpoperationnormalmode.c
@@ -98,43 +98,45 @@ gimp_operation_normal_parent_process (GeglOperation        *operation,
                                       const GeglRectangle  *result,
                                       gint                  level)
 {
-#if 0
-  /*  this code tries to be smart but is in fact just a too stupid
-   *  copy from gegl's normal mode. to fix it, it needs to take
-   *  mask and opacity into account
-   */
-  const GeglRectangle *in_extent  = NULL;
-  const GeglRectangle *aux_extent = NULL;
-  GObject             *input;
-  GObject             *aux;
-
-  /* get the raw values this does not increase the reference count */
-  input = gegl_operation_context_get_object (context, "input");
-  aux   = gegl_operation_context_get_object (context, "aux");
+  GimpOperationPointLayerMode *point;
 
-  /* pass the input/aux buffers directly through if they are not
-   * overlapping
-   */
-  if (input)
-    in_extent = gegl_buffer_get_abyss (GEGL_BUFFER (input));
+  point = GIMP_OPERATION_POINT_LAYER_MODE (operation);
 
-  if (! input ||
-      (aux && ! gegl_rectangle_intersect (NULL, in_extent, result)))
+  if (point->opacity == 1.0 &&
+      ! gegl_operation_context_get_object (context, "aux2"))
     {
-      gegl_operation_context_set_object (context, "output", aux);
-      return TRUE;
-    }
+      const GeglRectangle *in_extent  = NULL;
+      const GeglRectangle *aux_extent = NULL;
+      GObject             *input;
+      GObject             *aux;
+
+      /* get the raw values this does not increase the reference count */
+      input = gegl_operation_context_get_object (context, "input");
+      aux   = gegl_operation_context_get_object (context, "aux");
+
+      /* pass the input/aux buffers directly through if they are not
+       * overlapping
+       */
+      if (input)
+        in_extent = gegl_buffer_get_abyss (GEGL_BUFFER (input));
+
+      if (! input ||
+          (aux && ! gegl_rectangle_intersect (NULL, in_extent, result)))
+        {
+          gegl_operation_context_set_object (context, "output", aux);
+          return TRUE;
+        }
 
-  if (aux)
-    aux_extent = gegl_buffer_get_abyss (GEGL_BUFFER (aux));
+      if (aux)
+        aux_extent = gegl_buffer_get_abyss (GEGL_BUFFER (aux));
 
-  if (! aux ||
-      (input && ! gegl_rectangle_intersect (NULL, aux_extent, result)))
-    {
-      gegl_operation_context_set_object (context, "output", input);
-      return TRUE;
+      if (! aux ||
+          (input && ! gegl_rectangle_intersect (NULL, aux_extent, result)))
+        {
+          gegl_operation_context_set_object (context, "output", input);
+          return TRUE;
+        }
     }
-#endif
 
   /* chain up, which will create the needed buffers for our actual
    * process function


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