app: reset the scribbles at every new strokes.

Every time we press for a selection update, we will start with a blank
tri-map, instead of reusing previous "scribbles". In my various tests,
it felt like I would get better results this way. Also if you do some
mistakes (maybe getting off-border of your object in a previous stroke),
it would be much harder to fix, unless you are alway showing the
scribbles.

One can consider that once you edited the image selection, what is done
is done. You don't constantly edit the past, and your resulting
selection could have been done with any other selection tool (how it was
done doesn't matter anymore). This makes the tool actually stateless
in-between strokes.

Note that I reset the tri-map at the start of a stroke, rather than at
the end. This way, it still allows one to see the previous stroke (it
can be useful for verifying how it was done before undoing and
retrying).
This commit is contained in:
Jehan 2025-11-26 23:17:33 +01:00
parent 77d1b66edd
commit e8b160a5e1

View file

@ -231,7 +231,8 @@ gimp_paint_select_tool_button_press (GimpTool *tool,
GimpButtonPressType press_type,
GimpDisplay *display)
{
GimpPaintSelectTool *ps_tool = GIMP_PAINT_SELECT_TOOL (tool);
GimpPaintSelectTool *ps_tool = GIMP_PAINT_SELECT_TOOL (tool);
GeglColor *grey = gegl_color_new ("#888");
if (tool->display && display != tool->display)
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, tool->display);
@ -247,9 +248,14 @@ gimp_paint_select_tool_button_press (GimpTool *tool,
ps_tool->last_pos.x = coords->x;
ps_tool->last_pos.y = coords->y;
/* Always reset the "scribbles" to start with a blank slate. */
gegl_buffer_set_color (ps_tool->trimap, NULL, grey);
ps_tool->process = gimp_paint_select_tool_paint_scribble (ps_tool);
gimp_tool_control_activate (tool->control);
g_object_unref (grey);
}
static void