app: improve brush outline position when not snapping to stroke

In GimpPaintTool, track the cursor position separately from the
current paint core position, so that the brush outline doesn't lag
behind the cursor while painting.
This commit is contained in:
Ell 2020-02-08 11:48:50 +02:00
parent 893990afce
commit d244a079ca
3 changed files with 11 additions and 2 deletions

View File

@ -518,6 +518,9 @@ gimp_paint_tool_paint_motion (GimpPaintTool *paint_tool,
data->coords.x -= off_x;
data->coords.y -= off_y;
paint_tool->cursor_x = data->coords.x;
paint_tool->cursor_y = data->coords.y;
gimp_paint_core_smooth_coords (core, paint_options, &data->coords);
/* Don't paint while the Shift key is pressed for line drawing */

View File

@ -604,6 +604,9 @@ gimp_paint_tool_oper_update (GimpTool *tool,
core->cur_coords.x -= off_x;
core->cur_coords.y -= off_y;
paint_tool->cursor_x = core->cur_coords.x;
paint_tool->cursor_y = core->cur_coords.y;
if (display == tool->display && (state & GIMP_PAINT_TOOL_LINE_MASK))
{
/* If shift is down and this is not the first paint stroke,
@ -704,8 +707,8 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
}
else
{
cur_x = core->cur_coords.x + off_x;
cur_y = core->cur_coords.y + off_y;
cur_x = paint_tool->cursor_x + off_x;
cur_y = paint_tool->cursor_y + off_y;
if (paint_tool->draw_line &&
! gimp_tool_control_is_active (GIMP_TOOL (draw_tool)->control))

View File

@ -62,6 +62,9 @@ struct _GimpPaintTool
GimpDisplay *display;
GimpDrawable *drawable;
gdouble cursor_x;
gdouble cursor_y;
gdouble paint_x;
gdouble paint_y;
};