[gimp] app: s/gdouble inertia_factor/gboolean event_fill/ in eval_event()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: s/gdouble inertia_factor/gboolean event_fill/ in eval_event()
- Date: Sun, 17 Apr 2011 18:00:45 +0000 (UTC)
commit aa7c31b802d5c51ab36d666fd323b6e4bf8c34ad
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 17 19:59:31 2011 +0200
app: s/gdouble inertia_factor/gboolean event_fill/ in eval_event()
Also remove "gdouble max_coord_smooth" from GimpTool and simply use
the existing motion mode for deciding whether or not to fill in
events.
app/display/gimpdisplayshell-tool-events.c | 21 ++++++++++++---------
app/display/gimpmotionbuffer.c | 11 +----------
app/display/gimpmotionbuffer.h | 2 +-
app/tools/gimppainttool.c | 3 ---
app/tools/gimptool.c | 1 -
app/tools/gimptool.h | 2 --
6 files changed, 14 insertions(+), 26 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 94acc17..9deceb2 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -811,6 +811,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{
GdkEventMotion *mevent = (GdkEventMotion *) event;
GdkEvent *compressed_motion = NULL;
+ GimpMotionMode motion_mode = GIMP_MOTION_MODE_EXACT;
GimpTool *active_tool;
if (gimp->busy)
@@ -818,10 +819,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
active_tool = tool_manager_get_active (gimp);
+ if (active_tool)
+ motion_mode = gimp_tool_control_get_motion_mode (active_tool->control);
+
if (shell->scrolling ||
- (active_tool &&
- gimp_tool_control_get_motion_mode (active_tool->control) ==
- GIMP_MOTION_MODE_COMPRESS))
+ motion_mode == GIMP_MOTION_MODE_COMPRESS)
{
compressed_motion = gimp_display_shell_compress_motion (shell);
@@ -894,8 +896,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
* amount of events between timestamps is final or
* risk loosing some.
*/
- if ((gimp_tool_control_get_motion_mode (active_tool->control) ==
- GIMP_MOTION_MODE_EXACT) &&
+ if (motion_mode == GIMP_MOTION_MODE_EXACT &&
shell->display->config->use_event_history &&
gdk_device_get_history (mevent->device, mevent->window,
shell->motion_buffer->last_read_motion_time + 1,
@@ -928,7 +929,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
shell->scale_x,
shell->scale_y,
&image_coords,
- active_tool->max_coord_smooth,
+ TRUE,
history_events[i]->time))
{
gimp_display_shell_process_event_queue (shell,
@@ -944,13 +945,15 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
}
else
{
+ gboolean event_fill = (motion_mode == GIMP_MOTION_MODE_EXACT);
+
/* Early removal of useless events saves CPU time.
*/
if (gimp_motion_buffer_eval_event (shell->motion_buffer,
shell->scale_x,
shell->scale_y,
&image_coords,
- active_tool->max_coord_smooth,
+ event_fill,
time))
{
gimp_display_shell_process_event_queue (shell,
@@ -965,13 +968,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)))
{
/* Early removal of useless events saves CPU time.
- * Smoothing is 0.0 here for coasting.
+ * Pass event_fill = FALSE since we are only hovering.
*/
if (gimp_motion_buffer_eval_event (shell->motion_buffer,
shell->scale_x,
shell->scale_y,
&image_coords,
- 0.0,
+ FALSE,
time))
{
/* then update the tool. */
diff --git a/app/display/gimpmotionbuffer.c b/app/display/gimpmotionbuffer.c
index 822b145..8ecb21d 100644
--- a/app/display/gimpmotionbuffer.c
+++ b/app/display/gimpmotionbuffer.c
@@ -207,7 +207,7 @@ gimp_motion_buffer_eval_event (GimpMotionBuffer *buffer,
gdouble scale_x,
gdouble scale_y,
GimpCoords *coords,
- gdouble inertia_factor,
+ gboolean event_fill,
guint32 time)
{
gdouble delta_time = 0.001;
@@ -216,21 +216,12 @@ gimp_motion_buffer_eval_event (GimpMotionBuffer *buffer,
gdouble dir_delta_x = 0.0;
gdouble dir_delta_y = 0.0;
gdouble distance = 1.0;
- gboolean event_fill = (inertia_factor > 0.0);
/* the last_read_motion_time most be set unconditionally, so set
* it early
*/
buffer->last_read_motion_time = time;
- /* Smoothing causes problems with cursor tracking when zoomed above
- * screen resolution so we need to supress it.
- */
- if (scale_x > 1.0 || scale_y > 1.0)
- {
- inertia_factor = 0.0;
- }
-
delta_time = (buffer->last_motion_delta_time * (1 - SMOOTH_FACTOR) +
(time - buffer->last_motion_time) * SMOOTH_FACTOR);
diff --git a/app/display/gimpmotionbuffer.h b/app/display/gimpmotionbuffer.h
index 2f98fd7..ded8b93 100644
--- a/app/display/gimpmotionbuffer.h
+++ b/app/display/gimpmotionbuffer.h
@@ -76,7 +76,7 @@ gboolean gimp_motion_buffer_eval_event (GimpMotionBuffer *buffer,
gdouble scale_x,
gdouble scale_y,
GimpCoords *coords,
- gdouble inertia_factor,
+ gboolean event_fill,
guint32 time);
void gimp_motion_buffer_push_event_history (GimpMotionBuffer *buffer,
GimpCoords *coords);
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index d0e502f..db0d54c 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -139,9 +139,6 @@ gimp_paint_tool_init (GimpPaintTool *paint_tool)
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.80;
-
paint_tool->core = NULL;
}
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index be909f4..78aa9e1 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -185,7 +185,6 @@ gimp_tool_init (GimpTool *tool)
tool->modifier_state = 0;
tool->active_modifier_state = 0;
tool->button_press_state = 0;
- tool->max_coord_smooth = 0.0;
}
static void
diff --git a/app/tools/gimptool.h b/app/tools/gimptool.h
index 10efefa..24f5f8b 100644
--- a/app/tools/gimptool.h
+++ b/app/tools/gimptool.h
@@ -47,8 +47,6 @@ struct _GimpTool
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]