app: improve warp-tool cropped-area calculation
In the warp tool, use the gegl:map-relative node to calculate the
affected drawable area to which the filter is cropped, to account
for box filtering.
(cherry picked from commit daa09ef602
)
This commit is contained in:
@ -123,9 +123,10 @@ static void gimp_warp_tool_set_sampler (GimpWarpTool *wt,
|
||||
gboolean commit);
|
||||
static GeglRectangle
|
||||
gimp_warp_tool_get_stroke_bounds (GeglNode *node);
|
||||
static GeglRectangle
|
||||
gimp_warp_tool_get_node_bounds (GeglNode *node);
|
||||
static GeglRectangle gimp_warp_tool_get_node_bounds (GeglNode *node);
|
||||
static void gimp_warp_tool_clear_node_bounds (GeglNode *node);
|
||||
static GeglRectangle gimp_warp_tool_get_invalidated_by_change (GimpWarpTool *wt,
|
||||
const GeglRectangle *area);
|
||||
static void gimp_warp_tool_update_bounds (GimpWarpTool *wt);
|
||||
static void gimp_warp_tool_update_area (GimpWarpTool *wt,
|
||||
const GeglRectangle *area,
|
||||
@ -620,6 +621,7 @@ gimp_warp_tool_options_notify (GimpTool *tool,
|
||||
{
|
||||
gimp_warp_tool_set_sampler (wt, /* commit = */ FALSE);
|
||||
|
||||
gimp_warp_tool_update_bounds (wt);
|
||||
gimp_warp_tool_update_stroke (wt, NULL);
|
||||
}
|
||||
}
|
||||
@ -638,6 +640,7 @@ gimp_warp_tool_options_notify (GimpTool *tool,
|
||||
{
|
||||
gimp_warp_tool_set_sampler (wt, /* commit = */ FALSE);
|
||||
|
||||
gimp_warp_tool_update_bounds (wt);
|
||||
gimp_warp_tool_update_stroke (wt, NULL);
|
||||
}
|
||||
}
|
||||
@ -1072,6 +1075,26 @@ gimp_warp_tool_clear_node_bounds (GeglNode *node)
|
||||
g_object_set_data (G_OBJECT (node), "gimp-warp-tool-bounds", NULL);
|
||||
}
|
||||
|
||||
static GeglRectangle
|
||||
gimp_warp_tool_get_invalidated_by_change (GimpWarpTool *wt,
|
||||
const GeglRectangle *area)
|
||||
{
|
||||
GeglRectangle result = *area;
|
||||
|
||||
if (! wt->filter)
|
||||
return result;
|
||||
|
||||
if (wt->render_node)
|
||||
{
|
||||
GeglOperation *operation = gegl_node_get_gegl_operation (wt->render_node);
|
||||
|
||||
result = gegl_operation_get_invalidated_by_change (operation,
|
||||
"aux", area);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_warp_tool_update_bounds (GimpWarpTool *wt)
|
||||
{
|
||||
@ -1085,6 +1108,8 @@ gimp_warp_tool_update_bounds (GimpWarpTool *wt)
|
||||
GeglNode *node = gegl_node_get_producer (wt->render_node, "aux", NULL);
|
||||
|
||||
bounds = gimp_warp_tool_get_node_bounds (node);
|
||||
|
||||
bounds = gimp_warp_tool_get_invalidated_by_change (wt, &bounds);
|
||||
}
|
||||
|
||||
gimp_drawable_filter_set_crop (wt->filter, &bounds, FALSE);
|
||||
@ -1095,17 +1120,12 @@ gimp_warp_tool_update_area (GimpWarpTool *wt,
|
||||
const GeglRectangle *area,
|
||||
gboolean synchronous)
|
||||
{
|
||||
GeglRectangle rect = *area;
|
||||
GeglRectangle rect;
|
||||
|
||||
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);
|
||||
}
|
||||
rect = gimp_warp_tool_get_invalidated_by_change (wt, area);
|
||||
|
||||
if (synchronous)
|
||||
{
|
||||
|
Reference in New Issue
Block a user