[clutter] actor: Fix the content box for CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT



commit c3e574a389c1a85a5d73a078f3cfcf0619ae0f26
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Aug 29 00:24:30 2012 +0200

    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

 clutter/clutter-actor.c |   40 +++++++++-------------------------------
 1 files changed, 9 insertions(+), 31 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index ebbef57..d4a64e3 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]