[gimp] app: restrict whole-drawable updates to groups with filters



commit 18870975b827bcc27a12064bebb5eadbd5a8ec47
Author: Ell <ell_se yahoo com>
Date:   Mon Jan 20 00:33:34 2020 +0200

    app: restrict whole-drawable updates to groups with filters
    
    Restrict last commit's workaround to layer groups only (which is
    the only relevant case ATM), since it negatively impacts the warp
    tool, which does rely on the ability to perform (accurate) partial
    updates with filters to improve performance.  It's only a temporary
    hack anyway.

 app/core/gimpdrawable.c   | 10 ----------
 app/core/gimpgrouplayer.c | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index b9270e56cd..43620b052f 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1102,16 +1102,6 @@ gimp_drawable_update (GimpDrawable *drawable,
 {
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
 
-  /* TODO: if the drawable has filters, they may influence the region affected
-   * by the update, but we don't currently handle this.  for now, do the most
-   * conservative thing and simply update the entire drawable.
-   */
-  if (! gimp_container_is_empty (drawable->private->filter_stack))
-    {
-      width  = -1;
-      height = -1;
-    }
-
   if (width < 0)
     {
       GeglRectangle bounding_box;
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 8c2c368910..a838c90294 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -33,6 +33,7 @@
 #include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-loops.h"
 
+#include "gimpdrawable-filters.h"
 #include "gimpgrouplayer.h"
 #include "gimpgrouplayerundo.h"
 #include "gimpimage.h"
@@ -2256,6 +2257,24 @@ gimp_group_layer_proj_update (GimpProjection *proj,
 
   if (! private->pass_through)
     {
+      /* TODO: groups can currently have a gegl:transform op attached as a filter
+       * when using a transform tool, in which case the updated region needs
+       * undergo the same transformation.  more generally, when a drawable has
+       * filters they may influence the area affected by drawable updates.
+       *
+       * this needs to be addressed much more generally at some point, but for now
+       * we just resort to updating the entire group when it has a filter (i.e.,
+       * when it's being used with a transform tool).  we restrict this to groups,
+       * and don't do this more generally in gimp_drawable_update(), because this
+       * negatively impacts the performance of the warp tool, which does perform
+       * accurate drawable updates while using a filter.
+       */
+      if (gimp_drawable_has_filters (GIMP_DRAWABLE (group)))
+        {
+          width  = -1;
+          height = -1;
+        }
+
       /*  the projection speaks in image coordinates, transform to layer
        *  coordinates when emitting our own update signal.
        */


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