actor: Fix the content box for CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT

The code for calculating the content box when the aspect ratio is
greater than 1 was broken. The same code that did the calculation for
aspect ratio less than 1 should be used in all cases.

Fixes: https://bugzilla.gnome.org/682161
This commit is contained in:
Debarshi Ray 2012-08-29 00:24:30 +02:00 committed by Emmanuele Bassi
parent 75e7fcdb2c
commit c3e574a389

View File

@ -19478,43 +19478,21 @@ clutter_actor_get_content_box (ClutterActor *self,
{
double r_c = content_w / content_h;
if (r_c >= 1.0)
if ((alloc_w / r_c) > alloc_h)
{
if ((alloc_w / r_c) > alloc_h)
{
box->x1 = 0.f;
box->x2 = alloc_w;
box->y1 = 0.f;
box->y2 = alloc_h;
box->y1 = (alloc_h - (alloc_w / r_c)) / 2.0f;
box->y2 = box->y1 + (alloc_w / r_c);
}
else
{
box->y1 = 0.f;
box->y2 = alloc_h;
box->x1 = (alloc_w - (alloc_h * r_c)) / 2.0f;
box->x2 = box->x1 + (alloc_h * r_c);
}
box->x1 = (alloc_w - (alloc_h * r_c)) / 2.0f;
box->x2 = box->x1 + (alloc_h * r_c);
}
else
{
if ((alloc_w / r_c) > alloc_h)
{
box->y1 = 0.f;
box->y2 = alloc_h;
box->x1 = 0.f;
box->x2 = alloc_w;
box->x1 = (alloc_w - (alloc_h * r_c)) / 2.0f;
box->x2 = box->x1 + (alloc_h * r_c);
}
else
{
box->x1 = 0.f;
box->x2 = alloc_w;
box->y1 = (alloc_h - (alloc_w / r_c)) / 2.0f;
box->y2 = box->y1 + (alloc_w / r_c);
}
box->y1 = (alloc_h - (alloc_w / r_c)) / 2.0f;
box->y2 = box->y1 + (alloc_w / r_c);
}
CLUTTER_NOTE (LAYOUT,