From 4fda40461e57c27db01f6fded7a0a5ee2d909597 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 27 Jun 2007 11:34:43 +0000 Subject: [PATCH] Fixed incorrect order of scaling and rotation in _clutter_actor_apply_modelview_transform() --- ChangeLog | 7 +++++++ clutter/clutter-actor.c | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index de4a4f1f2..12854ead0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-27 Tomas Frydrych + + * 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 * clutter/clutter-actor.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index d3b4a81ac..65a5e1071 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -581,7 +581,19 @@ _clutter_actor_apply_modelview_transform (ClutterActor * self) 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_rotatex (priv->rzang, 0, 0, CFX_ONE); @@ -605,12 +617,6 @@ _clutter_actor_apply_modelview_transform (ClutterActor * self) if (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) cogl_clip_set (&(priv->clip)); }