[gimp/gimp-2-10] app: avoid unnecessarily updating drawable after merging filter



commit 9db555149f35c45c17255bc9086d5f9bcb1ce312
Author: Ell <ell_se yahoo com>
Date:   Sat Jun 1 13:18:14 2019 -0400

    app: avoid unnecessarily updating drawable after merging filter
    
    In gimp_drawable_merge_filter(), add an "update" parameter, which
    specifies whether to update the affected region of the drawable
    after applying the filter.  Avoid updating the drawable when
    commiting a GimpDrawableFilter (and manually update the drawable if
    filter application was cancelled), and when anchoring a floating
    selection, since in both cases the relevant region of the drawable
    has already been updated.
    
    (cherry picked from commit d928a80b7faf48f637315b89eb6107647ff9d05b)

 app/core/gimpdrawable-filters.c         | 12 ++++++++----
 app/core/gimpdrawable-filters.h         |  3 ++-
 app/core/gimpdrawablefilter.c           |  6 +++++-
 app/core/gimplayer-floating-selection.c |  2 +-
 4 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimpdrawable-filters.c b/app/core/gimpdrawable-filters.c
index c771c26ca7..b39753ef86 100644
--- a/app/core/gimpdrawable-filters.c
+++ b/app/core/gimpdrawable-filters.c
@@ -109,7 +109,8 @@ gimp_drawable_merge_filter (GimpDrawable *drawable,
                             GimpFilter   *filter,
                             GimpProgress *progress,
                             const gchar  *undo_desc,
-                            gboolean      cancellable)
+                            gboolean      cancellable,
+                            gboolean      update)
 {
   GimpImage      *image;
   GimpApplicator *applicator;
@@ -225,9 +226,12 @@ gimp_drawable_merge_filter (GimpDrawable *drawable,
       gimp_applicator_set_output_format (applicator, applicator_output_format);
     }
 
-  gimp_drawable_update (drawable,
-                        rect.x, rect.y,
-                        rect.width, rect.height);
+  if (update)
+    {
+      gimp_drawable_update (drawable,
+                            rect.x, rect.y,
+                            rect.width, rect.height);
+    }
 
   return success;
 }
diff --git a/app/core/gimpdrawable-filters.h b/app/core/gimpdrawable-filters.h
index f7041e062b..a2c6972d6c 100644
--- a/app/core/gimpdrawable-filters.h
+++ b/app/core/gimpdrawable-filters.h
@@ -37,7 +37,8 @@ gboolean        gimp_drawable_merge_filter  (GimpDrawable *drawable,
                                              GimpFilter   *filter,
                                              GimpProgress *progress,
                                              const gchar  *undo_desc,
-                                             gboolean      cancellable);
+                                             gboolean      cancellable,
+                                             gboolean      update);
 
 
 #endif /* __GIMP_DRAWABLE_FILTERS_H__ */
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index 66427f5e6a..015222f9e4 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -481,10 +481,14 @@ gimp_drawable_filter_commit (GimpDrawableFilter *filter,
                                             GIMP_FILTER (filter),
                                             progress,
                                             gimp_object_get_name (filter),
-                                            cancellable);
+                                            cancellable,
+                                            FALSE);
 
       gimp_drawable_filter_remove_filter (filter);
 
+      if (! success)
+        gimp_drawable_filter_update_drawable (filter, NULL);
+
       g_signal_emit (filter, drawable_filter_signals[FLUSH], 0);
     }
 
diff --git a/app/core/gimplayer-floating-selection.c b/app/core/gimplayer-floating-selection.c
index f43ce985b3..84d1fea0a3 100644
--- a/app/core/gimplayer-floating-selection.c
+++ b/app/core/gimplayer-floating-selection.c
@@ -135,7 +135,7 @@ floating_sel_anchor (GimpLayer *layer)
     }
 
   if (filter)
-    gimp_drawable_merge_filter (drawable, filter, NULL, NULL, FALSE);
+    gimp_drawable_merge_filter (drawable, filter, NULL, NULL, FALSE, FALSE);
 
   gimp_image_remove_layer (image, layer, TRUE, NULL);
 


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