mirror of https://github.com/GNOME/gimp.git
app: GimpRectangleTool: Rounding error when moving/resizing with keyboard
Fix for bug #653186: When a rectangle selection is created or moved by mouse at certain zoom-levels (200%, 400%, 800%), its coordinates can become exactly .500. By then using the keyboard to move/resize in steps of one pixel, a rounding error occurs in gimp_rectangle_tool_update_int_rect(). This leads to the coordinate either not beeing changed at all or changed by 2 pixels at a time. The patch changes the function from using RINT() to ROUND() for the calculations, which prevents the rounding error from happening.
This commit is contained in:
parent
aae8787ee3
commit
074e2c088a
|
@ -4297,13 +4297,13 @@ gimp_rectangle_tool_update_int_rect (GimpRectangleTool *rect_tool)
|
|||
{
|
||||
GimpRectangleToolPrivate *priv = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
|
||||
|
||||
priv->x1_int = RINT (priv->x1);
|
||||
priv->y1_int = RINT (priv->y1);
|
||||
priv->x1_int = ROUND (priv->x1);
|
||||
priv->y1_int = ROUND (priv->y1);
|
||||
|
||||
if (gimp_rectangle_tool_rect_rubber_banding_func (rect_tool))
|
||||
{
|
||||
priv->width_int = (gint) RINT (priv->x2) - priv->x1_int;
|
||||
priv->height_int = (gint) RINT (priv->y2) - priv->y1_int;
|
||||
priv->width_int = (gint) ROUND (priv->x2) - priv->x1_int;
|
||||
priv->height_int = (gint) ROUND (priv->y2) - priv->y1_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue