gimp r25516 - in trunk: . app/tools
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25516 - in trunk: . app/tools
- Date: Thu, 24 Apr 2008 06:55:59 +0100 (BST)
Author: martinn
Date: Thu Apr 24 05:55:59 2008
New Revision: 25516
URL: http://svn.gnome.org/viewvc/gimp?rev=25516&view=rev
Log:
2008-04-24 Martin Nordholts <martinn svn gnome org>
* app/tools/gimprectangletool.c
(gimp_rectangle_tool_options_notify): Do appropriate equal and
not-equal comparions for floting point numbers. Fixes bug #527863.
Modified:
trunk/ChangeLog
trunk/app/tools/gimprectangletool.c
Modified: trunk/app/tools/gimprectangletool.c
==============================================================================
--- trunk/app/tools/gimprectangletool.c (original)
+++ trunk/app/tools/gimprectangletool.c Thu Apr 24 05:55:59 2008
@@ -89,6 +89,8 @@
} SideToResize;
+#define FEQUAL(a,b) (fabs ((a) - (b)) < 0.0001)
+
#define GIMP_RECTANGLE_TOOL_GET_PRIVATE(obj) \
(gimp_rectangle_tool_get_private (GIMP_RECTANGLE_TOOL (obj)))
@@ -2209,19 +2211,23 @@
if (! strcmp (pspec->name, "x"))
{
- if (private->x1 != options_private->x)
- gimp_rectangle_tool_synthesize_motion (rect_tool,
- GIMP_RECTANGLE_TOOL_MOVING,
- options_private->x,
- private->y1);
+ if (! FEQUAL (private->x1, options_private->x))
+ {
+ gimp_rectangle_tool_synthesize_motion (rect_tool,
+ GIMP_RECTANGLE_TOOL_MOVING,
+ options_private->x,
+ private->y1);
+ }
}
else if (! strcmp (pspec->name, "y"))
{
- if (private->y1 != options_private->y)
- gimp_rectangle_tool_synthesize_motion (rect_tool,
- GIMP_RECTANGLE_TOOL_MOVING,
- private->x1,
- options_private->y);
+ if (! FEQUAL (private->y1, options_private->y))
+ {
+ gimp_rectangle_tool_synthesize_motion (rect_tool,
+ GIMP_RECTANGLE_TOOL_MOVING,
+ private->x1,
+ options_private->y);
+ }
}
else if (! strcmp (pspec->name, "width"))
{
@@ -2230,7 +2236,7 @@
*/
gdouble x2;
- if (private->x2 - private->x1 != options_private->width)
+ if (! FEQUAL (private->x2 - private->x1, options_private->width))
{
if (options_private->fixed_center)
{
@@ -2255,7 +2261,7 @@
*/
gdouble y2;
- if (private->y2 - private->y1 != options_private->height)
+ if (! FEQUAL (private->y2 - private->y1, options_private->height))
{
if (options_private->fixed_center)
{
@@ -2286,12 +2292,12 @@
* immedieately switch width and height of the pending
* rectangle.
*/
- if (options_private->fixed_rule_active &&
- tool->display != NULL &&
- tool->button_press_state == 0 &&
- tool->active_modifier_state == 0 &&
- options_private->desired_fixed_size_width == height &&
- options_private->desired_fixed_size_height == width)
+ if (options_private->fixed_rule_active &&
+ tool->display != NULL &&
+ tool->button_press_state == 0 &&
+ tool->active_modifier_state == 0 &&
+ FEQUAL (options_private->desired_fixed_size_width, height) &&
+ FEQUAL (options_private->desired_fixed_size_height, width))
{
gdouble x = private->x1;
gdouble y = private->y1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]