summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2012-05-29 15:39:59 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2012-08-10 10:18:16 +0100
commitaeadbe70ea89914e520fa9fa6a9959b7c761dd46 (patch)
tree792ff55de0d479af8eb48a10cbd267a2a1fc1769
parent497b656497b67d4bdc7169cb31c92ae54f52e5bc (diff)
downloadclutter-aeadbe70ea89914e520fa9fa6a9959b7c761dd46.tar.gz
actor: Finally fix RESIZE_ASPECT content gravity
Ensure that resizing transitions smoothly when switching between major axis; the allocation aspect ratio is not important: it's the size of the allocation that dictates the major axis. (cherry picked from commit b9533cb397d1b272c7975c6e904fcd46894022fa) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--clutter/clutter-actor.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 1e2fd85df..c3faff78a 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -18054,17 +18054,16 @@ clutter_actor_get_content_box (ClutterActor *self,
case CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT:
{
double r_c = content_w / content_h;
- double r_a = alloc_w / alloc_h;
if (r_c >= 1.0)
{
- if (r_a >= 1.0)
+ if ((alloc_w / r_c) > alloc_h)
{
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);
}
else
{
@@ -18077,7 +18076,7 @@ clutter_actor_get_content_box (ClutterActor *self,
}
else
{
- if (r_a >= 1.0)
+ if ((alloc_w / r_c) > alloc_h)
{
box->y1 = 0.f;
box->y2 = alloc_h;
@@ -18090,10 +18089,19 @@ clutter_actor_get_content_box (ClutterActor *self,
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,
+ "r_c: %.3f, r_a: %.3f\t"
+ "a: [%.2fx%.2f], c: [%.2fx%.2f]\t"
+ "b: [%.2f, %.2f, %.2f, %.2f]",
+ r_c, alloc_w / alloc_h,
+ alloc_w, alloc_h,
+ content_w, content_h,
+ box->x1, box->y1, box->x2, box->y2);
}
break;
}