[gimp/gimp-2-10] app: improve warp-tool invalidated-area calculation
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: improve warp-tool invalidated-area calculation
- Date: Sun, 3 Mar 2019 21:24:28 +0000 (UTC)
commit 579562f177f56f87369f2321e235a31711d9f425
Author: Ell <ell_se yahoo com>
Date: Sun Mar 3 14:10:40 2019 -0500
app: improve warp-tool invalidated-area calculation
In the warp tool, use the gegl:map-relative node to calculate the
invalidated drawable area when the displacement field changes, to
account for box filtering.
(cherry picked from commit aa915280841f7e660d08696fe6a4f56d909ff120)
app/tools/gimpwarptool.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 9708483b46..1d93d2924b 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -20,7 +20,7 @@
#include "config.h"
#include <gegl.h>
-#include "gegl-utils.h"
+#include <gegl-plugin.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -127,6 +127,8 @@ static GeglRectangle
gimp_warp_tool_get_node_bounds (GeglNode *node);
static void gimp_warp_tool_clear_node_bounds (GeglNode *node);
static void gimp_warp_tool_update_bounds (GimpWarpTool *wt);
+static void gimp_warp_tool_update_area (GimpWarpTool *wt,
+ const GeglRectangle *area);
static void gimp_warp_tool_update_stroke (GimpWarpTool *wt,
GeglNode *node);
static void gimp_warp_tool_stroke_changed (GeglPath *stroke,
@@ -1044,6 +1046,25 @@ gimp_warp_tool_update_bounds (GimpWarpTool *wt)
gimp_drawable_filter_set_crop (wt->filter, &bounds, FALSE);
}
+static void
+gimp_warp_tool_update_area (GimpWarpTool *wt,
+ const GeglRectangle *area)
+{
+ GeglRectangle rect = *area;
+
+ if (! wt->filter)
+ return;
+
+ if (wt->render_node)
+ {
+ GeglOperation *operation = gegl_node_get_gegl_operation (wt->render_node);
+
+ rect = gegl_operation_get_invalidated_by_change (operation, "aux", &rect);
+ }
+
+ gimp_drawable_filter_apply (wt->filter, &rect);
+}
+
static void
gimp_warp_tool_update_stroke (GimpWarpTool *wt,
GeglNode *node)
@@ -1073,7 +1094,7 @@ gimp_warp_tool_update_stroke (GimpWarpTool *wt,
bounds.width, bounds.height);
#endif
- gimp_drawable_filter_apply (wt->filter, &bounds);
+ gimp_warp_tool_update_area (wt, &bounds);
}
}
@@ -1107,7 +1128,7 @@ gimp_warp_tool_stroke_changed (GeglPath *path,
gimp_warp_tool_update_bounds (wt);
}
- gimp_drawable_filter_apply (wt->filter, &update_region);
+ gimp_warp_tool_update_area (wt, &update_region);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]