[gimp/gimp-2-10] app: use GimpDrawableFilter in gimp_drawable_apply_operation()



commit bb039c84019c0663d918e8677113510f3a1f4464
Author: Ell <ell_se yahoo com>
Date:   Sat Dec 29 14:23:38 2018 -0500

    app: use GimpDrawableFilter in gimp_drawable_apply_operation()
    
    In gimp_drawable_apply_operation(), use a temporary
    GimpDrawableFilter to apply the operation, instead of using a
    shadow buffer.  This renders and composits the op directly into the
    drawable buffer, avoiding an intermediate buffer, requiring less
    space and speeding up processing.
    
    (cherry picked from commit b201f735628f2c6662a6167f20dd67faef74e3d8)

 app/core/gimpdrawable-operation.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimpdrawable-operation.c b/app/core/gimpdrawable-operation.c
index 4f38bfd5e7..76c13b20a1 100644
--- a/app/core/gimpdrawable-operation.c
+++ b/app/core/gimpdrawable-operation.c
@@ -27,11 +27,11 @@
 
 #include "core-types.h"
 
-#include "gegl/gimp-gegl-apply-operation.h"
+#include "gegl/gimpapplicator.h"
 
 #include "gimpdrawable.h"
 #include "gimpdrawable-operation.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawablefilter.h"
 #include "gimpprogress.h"
 #include "gimpsettings.h"
 
@@ -44,8 +44,8 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
                                const gchar  *undo_desc,
                                GeglNode     *operation)
 {
-  GeglBuffer    *dest_buffer;
-  GeglRectangle  rect;
+  GimpDrawableFilter *filter;
+  GimpApplicator     *applicator;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
@@ -54,21 +54,20 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
   g_return_if_fail (GEGL_IS_NODE (operation));
 
   if (! gimp_item_mask_intersect (GIMP_ITEM (drawable),
-                                  &rect.x,     &rect.y,
-                                  &rect.width, &rect.height))
-    return;
+                                  NULL, NULL, NULL, NULL))
+    {
+      return;
+    }
 
-  dest_buffer = gimp_drawable_get_shadow_buffer (drawable);
+  filter     = gimp_drawable_filter_new (drawable, undo_desc, operation, NULL);
+  applicator = gimp_filter_get_applicator (GIMP_FILTER (filter));
 
-  gimp_gegl_apply_operation (gimp_drawable_get_buffer (drawable),
-                             progress, undo_desc,
-                             operation,
-                             dest_buffer, &rect, FALSE);
+  gimp_applicator_set_cache (applicator, FALSE);
 
-  gimp_drawable_merge_shadow_buffer (drawable, TRUE, undo_desc);
-  gimp_drawable_free_shadow_buffer (drawable);
+  gimp_drawable_filter_apply  (filter, NULL);
+  gimp_drawable_filter_commit (filter, progress, TRUE);
 
-  gimp_drawable_update (drawable, rect.x, rect.y, rect.width, rect.height);
+  g_object_unref (filter);
 
   if (progress)
     gimp_progress_end (progress);


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