Be more tolerant about natural_width < min_width
Due to the accumulation of floating point errors, natural_width and min_width can diverge significantly even if the math for computing them is correct. So just clamp natural_width to min_width instead of warning about it. http://bugzilla.openedhand.com/show_bug.cgi?id=1632 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
parent
583a86b537
commit
2b7e98f4b3
@ -4464,8 +4464,6 @@ 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
|
||||
@ -4513,14 +4511,11 @@ clutter_actor_get_preferred_width (ClutterActor *self,
|
||||
&min_width,
|
||||
&natural_width);
|
||||
|
||||
if (natural_width < min_width - FLOAT_EPSILON)
|
||||
{
|
||||
g_warning ("Actor of type %s reported a natural width "
|
||||
"of %.2f px lower than min width %.2f px",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
natural_width,
|
||||
min_width);
|
||||
}
|
||||
/* Due to accumulated float errors, it's better not to warn
|
||||
* on this, but just fix it.
|
||||
*/
|
||||
if (natural_width < min_width)
|
||||
natural_width = min_width;
|
||||
|
||||
if (!priv->min_width_set)
|
||||
priv->request_min_width = min_width;
|
||||
@ -4585,14 +4580,11 @@ clutter_actor_get_preferred_height (ClutterActor *self,
|
||||
&min_height,
|
||||
&natural_height);
|
||||
|
||||
if (natural_height < min_height - FLOAT_EPSILON)
|
||||
{
|
||||
g_warning ("Actor of type %s reported a natural height "
|
||||
"of %.2f px lower than min height %.2f px",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
natural_height,
|
||||
min_height);
|
||||
}
|
||||
/* Due to accumulated float errors, it's better not to warn
|
||||
* on this, but just fix it.
|
||||
*/
|
||||
if (natural_height < min_height)
|
||||
natural_height = min_height;
|
||||
|
||||
if (!priv->min_height_set)
|
||||
priv->request_min_height = min_height;
|
||||
|
Loading…
Reference in New Issue
Block a user