app/display/gimpdisplayshell-callbacks.c applied patch from Alexia Death
2008-01-22 Sven Neumann <sven@gimp.org> * app/display/gimpdisplayshell-callbacks.c * app/display/gimpdisplayshell-coords.[ch]: applied patch from Alexia Death with further event filter improvements (bug #508639). svn path=/trunk/; revision=24672
This commit is contained in:
committed by
Sven Neumann
parent
39db00b89e
commit
0a368b32e7
@ -1,3 +1,9 @@
|
||||
2008-01-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c
|
||||
* app/display/gimpdisplayshell-coords.[ch]: applied patch from
|
||||
Alexia Death with further event filter improvements (bug #508639).
|
||||
|
||||
2008-01-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/pcx.c: corrected check of the bytesperline field
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
|
||||
#define DEFAULT_EVENT_SMOOTHING 0.7
|
||||
|
||||
#define DEFAULT_EVENT_FILTER 0.5
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
@ -1248,6 +1248,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
if (gimp_display_shell_eval_event (shell,
|
||||
&image_coords,
|
||||
DEFAULT_EVENT_SMOOTHING,
|
||||
DEFAULT_EVENT_FILTER,
|
||||
history_events[i]->time))
|
||||
{
|
||||
tool_manager_motion_active (gimp,
|
||||
@ -1269,6 +1270,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
if (gimp_display_shell_eval_event (shell,
|
||||
&image_coords,
|
||||
DEFAULT_EVENT_SMOOTHING,
|
||||
DEFAULT_EVENT_FILTER,
|
||||
time))
|
||||
{
|
||||
tool_manager_motion_active (gimp,
|
||||
@ -1289,7 +1291,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
/* Early removal of useless events saves CPU time.
|
||||
* Smoothing is 0.0 here for coasting.
|
||||
*/
|
||||
if (gimp_display_shell_eval_event (shell, &image_coords, 0.0, time))
|
||||
if (gimp_display_shell_eval_event (shell,
|
||||
&image_coords,
|
||||
0.0,
|
||||
DEFAULT_EVENT_FILTER,
|
||||
time))
|
||||
{
|
||||
tool_manager_oper_update_active (gimp,
|
||||
&image_coords, state,
|
||||
|
||||
@ -210,6 +210,7 @@ gboolean
|
||||
gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
GimpCoords *coords,
|
||||
gdouble inertia_factor,
|
||||
gdouble filter_treshhold,
|
||||
guint32 time)
|
||||
{
|
||||
const gdouble smooth_factor = 0.3;
|
||||
@ -230,10 +231,10 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
gdouble dx = coords->delta_x = shell->last_coords.x - coords->x;
|
||||
gdouble dy = coords->delta_y = shell->last_coords.y - coords->y;
|
||||
|
||||
/* Events with distances less than 1 in either motion direction
|
||||
* are not worth handling.
|
||||
/* Events with distances less than the filter_threshold are not
|
||||
worth handling.
|
||||
*/
|
||||
if (fabs (dx) < 1.0 && fabs (dy) < 1.0)
|
||||
if (fabs (dx) < filter_treshhold && fabs (dy) < filter_treshhold)
|
||||
return FALSE;
|
||||
|
||||
coords->delta_time = thistime - shell->last_disp_motion_time;
|
||||
@ -260,7 +261,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
coords->velocity = MIN (coords->velocity, 1.0);
|
||||
}
|
||||
|
||||
if (inertia_factor > 0)
|
||||
if (inertia_factor > 0 && coords->distance > 0)
|
||||
{
|
||||
/* Apply smoothing to X and Y. */
|
||||
|
||||
@ -292,7 +293,7 @@ gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
new_x = (shell->last_coords.x - coords->delta_x) * 0.5 + coords->x * 0.5;
|
||||
new_y = (shell->last_coords.y - coords->delta_y) * 0.5 + coords->y * 0.5;
|
||||
|
||||
cur_deviation = SQR(coords->x-new_x) + SQR(coords->y-new_y);
|
||||
cur_deviation = SQR (coords->x - new_x) + SQR (coords->y - new_y);
|
||||
|
||||
while (cur_deviation >= max_deviation)
|
||||
{
|
||||
|
||||
@ -41,6 +41,7 @@ void gimp_display_shell_get_device_state (GimpDisplayShell *shell,
|
||||
gboolean gimp_display_shell_eval_event (GimpDisplayShell *shell,
|
||||
GimpCoords *coords,
|
||||
gdouble inertia_factor,
|
||||
gdouble filter_threshhold,
|
||||
guint32 time);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user