From e94e5ad65b34dfad507de6eb63225798434f31ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Thu, 19 Mar 2009 14:42:50 +0000 Subject: [PATCH] [actor] use an epsilon whens sanity checking sizes Clutter was complaining about netural width smaller than minimum widths (differences around 0.0005) by using an epsilon value of 1e-4 for these floating point comparisons, these warnings have now been silenced. --- clutter/clutter-actor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 9e5a0411b..6751587e1 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -3552,6 +3552,8 @@ clutter_actor_get_preferred_size (ClutterActor *self, *natural_height_p = natural_height; } +#define FLOAT_EPSILON (1e-4) /* 1/1000 pixel is the precision used */ + /** * clutter_actor_get_preferred_width: * @self: A #ClutterActor @@ -3597,7 +3599,7 @@ clutter_actor_get_preferred_width (ClutterActor *self, &min_width, &natural_width); - if (natural_width < min_width) + if (natural_width < min_width - FLOAT_EPSILON) { g_warning ("Actor of type %s reported a natural width " "of %" CLUTTER_UNITS_FORMAT " (%d px) lower " @@ -3668,7 +3670,7 @@ clutter_actor_get_preferred_height (ClutterActor *self, &min_height, &natural_height); - if (natural_height < min_height) + if (natural_height < min_height - FLOAT_EPSILON) { g_warning ("Actor of type %s reported a natural height " "of %" CLUTTER_UNITS_FORMAT " (%d px) lower than "