Fixed CCW rotation in rotate behaviour (bug 483); fixed overall path length calculati...
authorTomas Frydrych <tf@openedhand.com>
Wed, 22 Aug 2007 10:33:26 +0000 (10:33 +0000)
committerTomas Frydrych <tf@openedhand.com>
Wed, 22 Aug 2007 10:33:26 +0000 (10:33 +0000)
ChangeLog
clutter/clutter-behaviour-ellipse.c
clutter/clutter-behaviour-rotate.c

index 666a6e4..c3a3c4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-22  Tomas Frydrych  <tf@openedhand.com>
+       
+       * clutter/clutter-behaviour-rotate.c:
+       * clutter/clutter-behaviour-ellipse.c:
+
+       Fixed CCW rotation in rotate behaviour (bug 483); fixed overall
+       path length calculation for angles > 360 in rotate and ellipse.
+
 2007-08-22  Emmanuele Bassi  <ebassi@openedhand.com>
 
        * clutter/clutter-main.c (clutter_threads_dispatch_free): Remove
@@ -6,7 +14,7 @@
        holding the lock is unpredictable for the library. Leave a comment
        with the relevant bug number in GNOME's Bugzilla and wait for a
        fix in GLib.
-
+       
 2007-08-21  Emmanuele Bassi  <ebassi@openedhand.com>
 
        * clutter/clutter-event.c: Correctly initialise the state
@@ -49,7 +57,7 @@
        (clutter_sqrti):
 
        Fixes for 64-bit platforms; use of SSE builtin when available
-       (patches by Gwenole Beauchesne).
+       (bugs 478, 479, patches by Gwenole Beauchesne).
 
 2007-08-20  Emmanuele Bassi  <ebassi@openedhand.com>
 
index 265a8ba..6d7e660 100644 (file)
@@ -205,21 +205,23 @@ clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
            priv->direction == CLUTTER_ROTATE_CCW)
     {
       ClutterAngle diff;
-
+      ClutterAngle angle_begin = priv->angle_begin + 256;
+      ClutterAngle angle_end   = priv->angle_end + 256;
+      
       /* Work out the angular length of the arch represented by the
        * end angle in CCW direction
        */
-      if (priv->angle_end > 1024)
+      if (angle_end >= 1024)
         {
-          gint rounds = priv->angle_end / 1024;
+          gint rounds = angle_end / 1024;
           ClutterAngle a1 = rounds * 1024;
-          ClutterAngle a2 = 1024 - (priv->angle_end - a1);
+          ClutterAngle a2 = - (angle_end - a1);
 
-          diff = a1 + a2 + priv->angle_begin;
+          diff = a1 + a2 + angle_begin;
         }
       else
         {
-          diff = 1024 - priv->angle_end + priv->angle_begin;
+          diff = 1024 - angle_end + angle_begin;
         }
       
       angle = priv->angle_begin - (diff * alpha / CLUTTER_ALPHA_MAX_ALPHA);
@@ -228,23 +230,25 @@ clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
            priv->direction == CLUTTER_ROTATE_CW)
     {
       ClutterAngle diff;
+      ClutterAngle angle_begin = priv->angle_begin + 256;
+      ClutterAngle angle_end   = priv->angle_end + 256;
 
       /* Work out the angular length of the arch represented by the
        * begin angle in CW direction
        */
-      if (priv->angle_begin > 1024)
+      if (angle_begin >= 1024)
         {
-          gint rounds = priv->angle_begin/ 1024;
+          gint rounds = angle_begin / 1024;
           ClutterAngle a1 = rounds * 1024;
-          ClutterAngle a2 = 1024 - (priv->angle_begin - a1);
+          ClutterAngle a2 = - (angle_begin - a1);
 
-          diff = a1 + a2 + priv->angle_end;
+          diff = a1 + a2 + angle_end;
         }
       else
         {
-          diff = 1024 - priv->angle_begin + priv->angle_end;
+          diff = 1024 - angle_begin + angle_end;
         }
-      
+
       angle = priv->angle_begin + (diff * alpha / CLUTTER_ALPHA_MAX_ALPHA);
     }
   
index 1a14a1e..e961c2b 100644 (file)
@@ -145,13 +145,13 @@ clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
          /* Work out the angular length of the arch represented by the
           * end angle in CCW direction
           */
-         if (priv->angle_end > CLUTTER_INT_TO_FIXED (360))
+         if (priv->angle_begin >= CLUTTER_INT_TO_FIXED (360))
            {
              ClutterFixed rounds, a1, a2;
 
              rounds = priv->angle_begin / 360;
              a1 = rounds * 360;
-             a2 = CLUTTER_INT_TO_FIXED (360) - (priv->angle_begin - a1);
+             a2 = - (priv->angle_begin - a1);
 
              diff = a1 + a2 + priv->angle_end;
            }
@@ -171,20 +171,20 @@ clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
        {
          angle = CLUTTER_FIXED_MUL (factor, 
                                     (priv->angle_begin - priv->angle_end));
-         angle += priv->angle_end;
+         angle = priv->angle_begin - angle;
        }
       else
        {
          /* Work out the angular length of the arch represented by the
           * end angle in CCW direction
           */
-         if (priv->angle_end > CLUTTER_INT_TO_FIXED (360))
+         if (priv->angle_end >= CLUTTER_INT_TO_FIXED (360))
            {
              ClutterFixed rounds, a1, a2;
 
-             rounds = priv->angle_begin / 360;
+             rounds = priv->angle_end / 360;
              a1 = rounds * 360;
-             a2 = CLUTTER_INT_TO_FIXED (360) - (priv->angle_end - a1);
+             a2 = - (priv->angle_end - a1);
 
              diff = a1 + a2 + priv->angle_begin;
            }