gimp r24672 - in trunk: . app/display



Author: neo
Date: Tue Jan 22 14:53:34 2008
New Revision: 24672
URL: http://svn.gnome.org/viewvc/gimp?rev=24672&view=rev

Log:
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).


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-callbacks.c
   trunk/app/display/gimpdisplayshell-coords.c
   trunk/app/display/gimpdisplayshell-coords.h

Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c	(original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c	Tue Jan 22 14:53:34 2008
@@ -81,7 +81,7 @@
 
 
 #define DEFAULT_EVENT_SMOOTHING  0.7
-
+#define DEFAULT_EVENT_FILTER  0.5
 
 /*  local function prototypes  */
 
@@ -1248,6 +1248,7 @@
                         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 @@
                     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 @@
             /* 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,

Modified: trunk/app/display/gimpdisplayshell-coords.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-coords.c	(original)
+++ trunk/app/display/gimpdisplayshell-coords.c	Tue Jan 22 14:53:34 2008
@@ -210,6 +210,7 @@
 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 @@
       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 @@
           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 @@
           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)
             {

Modified: trunk/app/display/gimpdisplayshell-coords.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-coords.h	(original)
+++ trunk/app/display/gimpdisplayshell-coords.h	Tue Jan 22 14:53:34 2008
@@ -41,6 +41,7 @@
 gboolean gimp_display_shell_eval_event        (GimpDisplayShell *shell,
                                                GimpCoords       *coords,
                                                gdouble           inertia_factor,
+                                               gdouble           filter_threshhold,
                                                guint32           time);
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]