Fixed incorrect order of scaling and rotation in _clutter_actor_apply_modelview_transform()

This commit is contained in:
Tomas Frydrych 2007-06-27 11:34:43 +00:00
parent 4ed86c4bc1
commit 4fda40461e
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2007-06-27 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-actor.c:
(_clutter_actor_apply_modelview_transform):
Fixed incorrect order of scaling an rotation that was causing
objects that were both rotated and scaled to change position.
2007-06-27 Tomas Frydrych <tf@openedhand.com> 2007-06-27 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-actor.c: * clutter/clutter-actor.c:

View File

@ -581,7 +581,19 @@ _clutter_actor_apply_modelview_transform (ClutterActor * self)
0); 0);
} }
if (priv->rzang) /*
* because the rotation involves translations, we must scale before
* applying the rotations (if we apply the scale after the rotations,
* the translations included in the rotation are not scaled and so the
* entire object will move on the screen as a result of rotating it).
*/
if (priv->scale_x != CFX_ONE ||
priv->scale_y != CFX_ONE)
{
cogl_scale (priv->scale_x, priv->scale_y);
}
if (priv->rzang)
{ {
cogl_translate (priv->rzx, priv->rzy, 0); cogl_translate (priv->rzx, priv->rzy, 0);
cogl_rotatex (priv->rzang, 0, 0, CFX_ONE); cogl_rotatex (priv->rzang, 0, 0, CFX_ONE);
@ -605,12 +617,6 @@ _clutter_actor_apply_modelview_transform (ClutterActor * self)
if (priv->z) if (priv->z)
cogl_translate (0, 0, priv->z); cogl_translate (0, 0, priv->z);
if (priv->scale_x != CFX_ONE ||
priv->scale_y != CFX_ONE)
{
cogl_scale (priv->scale_x, priv->scale_y);
}
if (priv->has_clip) if (priv->has_clip)
cogl_clip_set (&(priv->clip)); cogl_clip_set (&(priv->clip));
} }