Fixed CCW rotation in rotate behaviour (bug 483); fixed overall path length calculation for angles > 360 in rotate and ellipse.

This commit is contained in:
Tomas Frydrych 2007-08-22 10:33:26 +00:00
parent 86ff4e0cac
commit a40f50fffa
3 changed files with 32 additions and 20 deletions

View File

@ -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> 2007-08-22 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-main.c (clutter_threads_dispatch_free): Remove * clutter/clutter-main.c (clutter_threads_dispatch_free): Remove
@ -49,7 +57,7 @@
(clutter_sqrti): (clutter_sqrti):
Fixes for 64-bit platforms; use of SSE builtin when available 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> 2007-08-20 Emmanuele Bassi <ebassi@openedhand.com>

View File

@ -205,21 +205,23 @@ clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
priv->direction == CLUTTER_ROTATE_CCW) priv->direction == CLUTTER_ROTATE_CCW)
{ {
ClutterAngle diff; 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 /* Work out the angular length of the arch represented by the
* end angle in CCW direction * 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 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 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); angle = priv->angle_begin - (diff * alpha / CLUTTER_ALPHA_MAX_ALPHA);
@ -228,21 +230,23 @@ clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
priv->direction == CLUTTER_ROTATE_CW) priv->direction == CLUTTER_ROTATE_CW)
{ {
ClutterAngle diff; 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 /* Work out the angular length of the arch represented by the
* begin angle in CW direction * 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 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 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); angle = priv->angle_begin + (diff * alpha / CLUTTER_ALPHA_MAX_ALPHA);

View File

@ -145,13 +145,13 @@ clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
/* Work out the angular length of the arch represented by the /* Work out the angular length of the arch represented by the
* end angle in CCW direction * 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; ClutterFixed rounds, a1, a2;
rounds = priv->angle_begin / 360; rounds = priv->angle_begin / 360;
a1 = rounds * 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; diff = a1 + a2 + priv->angle_end;
} }
@ -171,20 +171,20 @@ clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
{ {
angle = CLUTTER_FIXED_MUL (factor, angle = CLUTTER_FIXED_MUL (factor,
(priv->angle_begin - priv->angle_end)); (priv->angle_begin - priv->angle_end));
angle += priv->angle_end; angle = priv->angle_begin - angle;
} }
else else
{ {
/* Work out the angular length of the arch represented by the /* Work out the angular length of the arch represented by the
* end angle in CCW direction * 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; ClutterFixed rounds, a1, a2;
rounds = priv->angle_begin / 360; rounds = priv->angle_end / 360;
a1 = rounds * 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; diff = a1 + a2 + priv->angle_begin;
} }