gimp r25392 - in trunk/app: display tools



Author: neo
Date: Mon Apr  7 14:54:43 2008
New Revision: 25392
URL: http://svn.gnome.org/viewvc/gimp?rev=25392&view=rev

Log:
2008-04-07  Sven Neumann  <sven gimp org>

	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell-coords.[ch]
	* app/tools/gimppainttool.c
	* app/tools/gimptool.[ch]: applied patch from Alexia Death as
	attached to bug #508639. This change makes the smoothing depend on
	the active tool.


Modified:
   trunk/app/display/gimpdisplayshell-callbacks.c
   trunk/app/display/gimpdisplayshell-coords.c
   trunk/app/display/gimpdisplayshell-coords.h
   trunk/app/tools/gimppainttool.c
   trunk/app/tools/gimptool.c
   trunk/app/tools/gimptool.h

Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c	(original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c	Mon Apr  7 14:54:43 2008
@@ -78,10 +78,6 @@
 #include "gimp-intl.h"
 
 
-#define DEFAULT_EVENT_SMOOTHING  0.98
-#define DEFAULT_EVENT_FILTER     0.50
-
-
 /*  local function prototypes  */
 
 static void       gimp_display_shell_vscrollbar_update       (GtkAdjustment    *adjustment,
@@ -1142,8 +1138,7 @@
                          */
                         if (gimp_display_shell_eval_event (shell,
                                                            &image_coords,
-                                                           DEFAULT_EVENT_SMOOTHING,
-                                                           DEFAULT_EVENT_FILTER,
+                                                           active_tool->max_coord_smooth,
                                                            history_events[i]->time))
                           {
                             tool_manager_motion_active (gimp,
@@ -1164,8 +1159,7 @@
                      */
                     if (gimp_display_shell_eval_event (shell,
                                                        &image_coords,
-                                                       DEFAULT_EVENT_SMOOTHING,
-                                                       DEFAULT_EVENT_FILTER,
+                                                       active_tool->max_coord_smooth,
                                                        time))
                       {
                         tool_manager_motion_active (gimp,
@@ -1189,7 +1183,6 @@
             if (gimp_display_shell_eval_event (shell,
                                                &image_coords,
                                                0.0,
-                                               DEFAULT_EVENT_FILTER,
                                                time))
               {
                 tool_manager_oper_update_active (gimp,

Modified: trunk/app/display/gimpdisplayshell-coords.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-coords.c	(original)
+++ trunk/app/display/gimpdisplayshell-coords.c	Mon Apr  7 14:54:43 2008
@@ -209,26 +209,24 @@
 gimp_display_shell_eval_event (GimpDisplayShell *shell,
                                GimpCoords       *coords,
 			       gdouble           inertia_factor,
-                               gdouble           filter_treshhold,
 			       guint32           time)
 {
   const gdouble  smooth_factor = 0.3;
   guint32        thistime      = time;
   gdouble        dist;
-  gdouble        filter;
+  /* Ensure that events are filtered below screen resolution */
+  gdouble        filter        = MIN (shell->scale_x, shell->scale_y) / 2.0;
   gdouble        inertia;
 
-  /* Event filtering & smoothing causes problems with cursor tracking
+  /* Smoothing causes problems with cursor tracking
    * when zoomed above screen resolution so we need to supress it.
    */
   if (shell->scale_x > 1.0 || shell->scale_y > 1.0)
     {
-     filter  = filter_treshhold / (MAX (shell->scale_x, shell->scale_y));
-     inertia = 0.0;
+      inertia = 0.0;
     }
   else
     {
-      filter  = filter_treshhold;
       inertia = inertia_factor;
     }
 
@@ -305,8 +303,10 @@
           coords->delta_x = sin_avg * coords->distance;
           coords->delta_y = cos_avg * coords->distance;
 
-          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;
+          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);
 

Modified: trunk/app/display/gimpdisplayshell-coords.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-coords.h	(original)
+++ trunk/app/display/gimpdisplayshell-coords.h	Mon Apr  7 14:54:43 2008
@@ -41,7 +41,6 @@
 gboolean gimp_display_shell_eval_event        (GimpDisplayShell *shell,
                                                GimpCoords       *coords,
                                                gdouble           inertia_factor,
-                                               gdouble           filter_threshhold,
                                                guint32           time);
 
 

Modified: trunk/app/tools/gimppainttool.c
==============================================================================
--- trunk/app/tools/gimppainttool.c	(original)
+++ trunk/app/tools/gimppainttool.c	Mon Apr  7 14:54:43 2008
@@ -133,6 +133,9 @@
   paint_tool->status_line = _("Click to draw the line");
   paint_tool->status_ctrl = _("%s to pick a color");
 
+  /*  Paint tools benefit most from strong smoothing on coordinates  */
+  tool->max_coord_smooth  = 0.98;
+
   paint_tool->core        = NULL;
 }
 

Modified: trunk/app/tools/gimptool.c
==============================================================================
--- trunk/app/tools/gimptool.c	(original)
+++ trunk/app/tools/gimptool.c	Mon Apr  7 14:54:43 2008
@@ -158,6 +158,7 @@
   tool->modifier_state        = 0;
   tool->active_modifier_state = 0;
   tool->button_press_state    = 0;
+  tool->max_coord_smooth      = 0.0;
 }
 
 static void

Modified: trunk/app/tools/gimptool.h
==============================================================================
--- trunk/app/tools/gimptool.h	(original)
+++ trunk/app/tools/gimptool.h	Mon Apr  7 14:54:43 2008
@@ -47,6 +47,8 @@
 
   GimpDisplay     *display;     /*  pointer to currently active display    */
   GimpDrawable    *drawable;    /*  pointer to the tool's current drawable */
+  
+  gdouble         max_coord_smooth;
 
   /*  private state of gimp_tool_set_focus_display() and
    *  gimp_tool_set_[active_]modifier_state()



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