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



commit e14b95820cda04893e649ddae79875bfd1092fa7
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.
    
    (cherry picked from commit 18870975b827bcc27a12064bebb5eadbd5a8ec47)

 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 9c459ead0f..9a85eeef33 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1092,16 +1092,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 485e5d2210..bf65df18b6 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"
@@ -2252,6 +2253,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]