[gimp] app: avoid re-rendering group layers upon resizing



commit bd726c96bf6fc04f8153e5e2f0b1c62e0433bf96
Author: Ell <ell_se yahoo com>
Date:   Fri Aug 3 14:01:28 2018 -0400

    app: avoid re-rendering group layers upon resizing
    
    Make sure we don't unnecessarily update the group layer's drawable
    while flusing the group's projection during resizing, since we want
    to either update the entire drawable, or avoid any updates, when
    replacing the drawable's buffer.  Note that explicitly supressing
    updates in this case should theoretically not be necessary, but the
    fact that the call to gimp_projectable_bounds_changed() can result
    in reconstructing the projection (see the FIXME comment in that
    function) makes it necessary in some cases nonetheless.

 app/core/gimpgrouplayer.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index a9870620d8..6e37c9d591 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -62,8 +62,9 @@ struct _GimpGroupLayerPrivate
   gint            suspend_mask;
   GeglBuffer     *suspended_mask_buffer;
   GeglRectangle   suspended_mask_bounds;
-  gint            transforming;
   gint            direct_update;
+  gint            suspend_update;
+  gint            transforming;
   gboolean        expanded;
   gboolean        pass_through;
 
@@ -1956,8 +1957,16 @@ gimp_group_layer_update_size (GimpGroupLayer *group)
                                            old_x, old_y, old_width, old_height);
         }
 
+      /* avoid updating the drawable in response to projection updates while
+       * flushing the projection, since we want to either update the entire
+       * drawable, or not update at all, when setting the drawable's buffer.
+       */
+      private->suspend_update++;
+
       gimp_group_layer_flush (group);
 
+      private->suspend_update--;
+
       buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (private->projection));
 
       gimp_drawable_set_buffer_full (GIMP_DRAWABLE (group),
@@ -2173,6 +2182,9 @@ gimp_group_layer_proj_update (GimpProjection *proj,
 {
   GimpGroupLayerPrivate *private = GET_PRIVATE (group);
 
+  if (private->suspend_update)
+    return;
+
 #if 0
   g_printerr ("%s (%s) %d, %d (%d, %d)\n",
               G_STRFUNC, gimp_object_get_name (group),


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