mirror of https://github.com/GNOME/gimp.git
don't compare floating point numbers for equality.
2007-02-07 Sven Neumann <sven@gimp.org> * app/display/gimpdisplayshell-scale.c: don't compare floating point numbers for equality. svn path=/trunk/; revision=21857
This commit is contained in:
parent
f389d32a5d
commit
6e134e6d1c
|
@ -1,3 +1,8 @@
|
|||
2007-02-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-scale.c: don't compare floating
|
||||
point numbers for equality.
|
||||
|
||||
2007-02-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gui/gui.c: #define DBUS_API_SUBJECT_TO_CHANGE to fix
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
|
||||
#define SCALE_EPSILON 0.0001
|
||||
|
||||
#define SCALE_EQUALS(a,b) (fabs ((a) - (b)) < SCALE_EPSILON)
|
||||
|
||||
|
||||
typedef struct _ScaleDialogData ScaleDialogData;
|
||||
|
||||
struct _ScaleDialogData
|
||||
|
@ -273,7 +276,7 @@ gimp_display_shell_scale (GimpDisplayShell *shell,
|
|||
g_return_if_fail (shell->canvas != NULL);
|
||||
|
||||
if (zoom_type == GIMP_ZOOM_TO &&
|
||||
new_scale == gimp_zoom_model_get_factor (shell->zoom))
|
||||
SCALE_EQUALS (new_scale, gimp_zoom_model_get_factor (shell->zoom)))
|
||||
return;
|
||||
|
||||
x = shell->disp_width / 2;
|
||||
|
@ -428,8 +431,8 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
|
|||
/* Abort early if the values are all setup already. We don't
|
||||
* want to inadvertently resize the window (bug #164281).
|
||||
*/
|
||||
if (gimp_zoom_model_get_factor (shell->zoom) == scale &&
|
||||
shell->offset_x == offset_x &&
|
||||
if (SCALE_EQUALS (gimp_zoom_model_get_factor (shell->zoom), scale) &&
|
||||
shell->offset_x == offset_x &&
|
||||
shell->offset_y == offset_y)
|
||||
return;
|
||||
|
||||
|
@ -507,7 +510,7 @@ gimp_display_shell_scale_dialog (GimpDisplayShell *shell)
|
|||
return;
|
||||
}
|
||||
|
||||
if (fabs (shell->other_scale) < SCALE_EPSILON)
|
||||
if (SCALE_EQUALS (shell->other_scale, 0.0))
|
||||
{
|
||||
/* other_scale not yet initialized */
|
||||
shell->other_scale = gimp_zoom_model_get_factor (shell->zoom);
|
||||
|
|
Loading…
Reference in New Issue