From fd4b557fd788dc45e76adfdcaca1f02ac06cb8a8 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 10 Feb 2009 19:45:37 +0000 Subject: [PATCH] applied patch from Alexia Death that introduces smoothing for the stroke 2009-02-10 Sven Neumann * app/display/gimpdisplayshell-coords.c (gimp_display_shell_eval_event): applied patch from Alexia Death that introduces smoothing for the stroke direction (bug #520078). svn path=/trunk/; revision=28009 --- ChangeLog | 6 ++++++ app/display/gimpdisplayshell-coords.c | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b96b248884..98bb7d24a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-10 Sven Neumann + + * app/display/gimpdisplayshell-coords.c + (gimp_display_shell_eval_event): applied patch from Alexia Death + that introduces smoothing for the stroke direction (bug #520078). + 2009-02-09 Sven Neumann * app/actions/tools-commands.c (tools_paint_brush_angle_cmd_callback): diff --git a/app/display/gimpdisplayshell-coords.c b/app/display/gimpdisplayshell-coords.c index 129e20014d..8dece2373a 100644 --- a/app/display/gimpdisplayshell-coords.c +++ b/app/display/gimpdisplayshell-coords.c @@ -224,7 +224,6 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, gdouble delta_y = 0.0; gdouble distance = 1.0; gboolean event_fill = (inertia_factor > 0); - gint i; /* Smoothing causes problems with cursor tracking * when zoomed above screen resolution so we need to supress it. @@ -245,6 +244,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, { gdouble filter; gdouble dist; + gdouble delta_dir; delta_x = shell->last_coords.x - coords->x; delta_y = shell->last_coords.y - coords->y; @@ -292,7 +292,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, coords->velocity = MIN (coords->velocity, 1.0); } - if (delta_x == 0) + if (delta_x == 0.0) { coords->direction = shell->last_coords.direction; } @@ -303,6 +303,14 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell, coords->direction = coords->direction + 0.5; } + delta_dir = coords->direction - shell->last_coords.direction; + if ((fabs (delta_dir) > 0.5) && (delta_dir < 0.0)) + coords->direction = 0.3 * coords->direction + 0.7 * (shell->last_coords.direction - 1.0); + else if ((fabs (delta_dir) > 0.5) && (delta_dir > 0.0)) + coords->direction = 0.3 * coords->direction + 0.7 * (shell->last_coords.direction + 1.0); + else + coords->direction = 0.3 * coords->direction + 0.7 * shell->last_coords.direction; + /* High speed -> less smooth*/ inertia_factor *= (1 - coords->velocity);