handle event time as guint32. That's the type we deal with here and it

2005-01-03  Sven Neumann  <sven@gimp.org>

	* app/paint/gimpink.[ch]: handle event time as guint32. That's the
	type we deal with here and it avoids a crash that occured when
	autoscrolling with the Ink tool.

	* app/display/gimpdisplayshell-autoscroll.c: cosmetics.
This commit is contained in:
Sven Neumann 2005-01-02 23:09:54 +00:00 committed by Sven Neumann
parent aef1cf9306
commit 4e3026c637
4 changed files with 39 additions and 30 deletions

View File

@ -1,3 +1,11 @@
2005-01-03 Sven Neumann <sven@gimp.org>
* app/paint/gimpink.[ch]: handle event time as guint32. That's the
type we deal with here and it avoids a crash that occured when
autoscrolling with the Ink tool.
* app/display/gimpdisplayshell-autoscroll.c: cosmetics.
2005-01-02 Michael Natterer <mitch@gimp.org>
* app/display/Makefile.am

View File

@ -110,47 +110,49 @@ static gboolean
gimp_display_shell_autoscroll_timeout (gpointer data)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
GimpDisplay *gdisp = shell->gdisp;
ScrollInfo *info = shell->scroll_info;
GimpCoords device_coords;
GimpCoords image_coords;
gint off_x = 0;
gint off_y = 0;
gint dx = 0;
gint dy = 0;
info->time += AUTOSCROLL_DT;
gimp_display_shell_get_device_coords (shell,
info->device, &device_coords);
gimp_display_shell_get_device_coords (shell, info->device, &device_coords);
if (device_coords.x < 0)
off_x = device_coords.x;
dx = device_coords.x;
else if (device_coords.x > shell->disp_width)
off_x = device_coords.x - shell->disp_width;
dx = device_coords.x - shell->disp_width;
if (device_coords.y < 0)
off_y = device_coords.y;
dy = device_coords.y;
else if (device_coords.y > shell->disp_height)
off_y = device_coords.y - shell->disp_height;
dy = device_coords.y - shell->disp_height;
if (off_x == 0 && off_y == 0)
if (dx || dy)
{
GimpDisplay *gdisp = shell->gdisp;
info->time += AUTOSCROLL_DT;
gimp_display_shell_scroll (shell,
AUTOSCROLL_DX * (gdouble) dx,
AUTOSCROLL_DX * (gdouble) dy);
gimp_display_shell_untransform_coords (shell,
&device_coords, &image_coords);
tool_manager_motion_active (gdisp->gimage->gimp,
&image_coords,
info->time, info->state,
gdisp);
return TRUE;
}
else
{
g_free (info);
shell->scroll_info = NULL;
return FALSE;
}
gimp_display_shell_scroll (shell,
AUTOSCROLL_DX * (gdouble) off_x,
AUTOSCROLL_DX * (gdouble) off_y);
gimp_display_shell_untransform_coords (shell,
&device_coords, &image_coords);
tool_manager_motion_active (gdisp->gimage->gimp,
&image_coords,
info->time, info->state,
gdisp);
return TRUE;
}

View File

@ -270,11 +270,10 @@ gimp_ink_motion (GimpPaintCore *paint_core,
else
{
Blob *blob;
gdouble lasttime, thistime;
gdouble dist;
gdouble velocity;
lasttime = ink->last_time;
guint32 lasttime = ink->last_time;
guint32 thistime;
time_smoother_add (ink, time);
thistime = ink->last_time = time_smoother_result (ink);

View File

@ -54,7 +54,7 @@ struct _GimpInk
guint32 ts_buffer[TIME_SMOOTHER_BUFFER];
gint ts_index;
gdouble last_time; /* previous time of a motion event */
guint32 last_time; /* previous time of a motion event */
gdouble lastx, lasty; /* previous position of a motion event */
gboolean init_velocity;