After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690214 - clutter_actor_apply_transform() fails to rollback the pivot translation if an explicit transform has been set
clutter_actor_apply_transform() fails to rollback the pivot translation if an...
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: ClutterActor
git master
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-14 15:44 UTC by Emanuele Aina
Modified: 2012-12-14 19:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
actor: rollback pivot translation even on explicit transforms (4.23 KB, patch)
2012-12-14 17:15 UTC, Emanuele Aina
reviewed Details | Review
actor: rollback pivot translation even on explicit transforms (4.28 KB, patch)
2012-12-14 18:19 UTC, Emanuele Aina
committed Details | Review
actor: rollback pivot translation even on explicit transforms (4.28 KB, patch)
2012-12-14 19:35 UTC, Emanuele Aina
committed Details | Review

Description Emanuele Aina 2012-12-14 15:44:41 UTC
When setting an explicit transform with clutter_actor_set_transform() and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail to roll back the pivot-point translation done before multiplying the transformation matrix due to the "out:" label being slightly misplaced in clutter_actor_real_apply_transform()

This works properly:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);

This results in the actor being moved to the pivot-point position:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_matrix_init_identity(&matrix);
  cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
  clutter_actor_set_transform (actor, &matrix);
Comment 1 Emanuele Aina 2012-12-14 17:15:11 UTC
Created attachment 231577 [details] [review]
actor: rollback pivot translation even on explicit transforms

When setting an explicit transform with clutter_actor_set_transform()
and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail
to roll back the pivot-point translation done before multiplying the
transformation matrix due to the "out:" label being slightly misplaced
in clutter_actor_real_apply_transform().

This works properly:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);

This results in the actor being moved to the pivot-point position:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_matrix_init_identity(&matrix);
  cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
  clutter_actor_set_transform (actor, &matrix);

This also add a conformance test checking that even when using a
pivot-point, no matter how a rotation is set the resulting
transformation matrix will be the same.
Comment 2 Emmanuele Bassi (:ebassi) 2012-12-14 17:43:42 UTC
Review of attachment 231577 [details] [review]:

looks okay, a couple of issues in the unit test.

::: tests/conform/actor-invariants.c
@@ +450,3 @@
+  ClutterActor *stage, *actor_implicit, *actor_explicit;
+  ClutterMatrix transform, result_implicit, result_explicit;
+  ClutterActorBox allocation = { 0, 0, 90, 30 };

you can use CLUTTER_ACTOR_BOX_INIT here.

@@ +453,3 @@
+  gfloat angle = 30;
+
+  stage = clutter_stage_new ();

you need to destroy the stage you created here, at the end of the test, otherwise you'll leak it and two actors; though I'm not entirely sure a stage is needed at all - in which case you want to create actors, ref_sink() them, and destroy them at the end of the test.

@@ +458,3 @@
+  actor_explicit = clutter_actor_new ();
+
+  clutter_actor_add_child(stage, actor_implicit);

missing space between function and arguments.

@@ +459,3 @@
+
+  clutter_actor_add_child(stage, actor_implicit);
+  clutter_actor_add_child(stage, actor_explicit);

same as above.
Comment 3 Emanuele Aina 2012-12-14 18:15:32 UTC
Review of attachment 231577 [details] [review]:

::: tests/conform/actor-invariants.c
@@ +453,3 @@
+  gfloat angle = 30;
+
+  stage = clutter_stage_new ();

_clutter_actor_get_transform_info_or_defaults(priv->parent) complained (rightly so, called by way of clutter_actor_get_transform()→clutter_actor_real_apply_transform()) that the object was NULL.
Comment 4 Emanuele Aina 2012-12-14 18:19:16 UTC
Created attachment 231581 [details] [review]
actor: rollback pivot translation even on explicit transforms

When setting an explicit transform with clutter_actor_set_transform()
and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail
to roll back the pivot-point translation done before multiplying the
transformation matrix due to the "out:" label being slightly misplaced
in clutter_actor_real_apply_transform().

This works properly:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);

This results in the actor being moved to the pivot-point position:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_matrix_init_identity(&matrix);
  cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
  clutter_actor_set_transform (actor, &matrix);

This also add a conformance test checking that even when using a
pivot-point, no matter how a rotation is set the resulting
transformation matrix will be the same.
Comment 5 Emmanuele Bassi (:ebassi) 2012-12-14 18:47:31 UTC
Review of attachment 231581 [details] [review]:

looks good.
Comment 6 Emanuele Aina 2012-12-14 19:35:48 UTC
The following fix has been pushed:
219d0ef actor: rollback pivot translation even on explicit transforms
Comment 7 Emanuele Aina 2012-12-14 19:35:57 UTC
Created attachment 231587 [details] [review]
actor: rollback pivot translation even on explicit transforms

When setting an explicit transform with clutter_actor_set_transform()
and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail
to roll back the pivot-point translation done before multiplying the
transformation matrix due to the "out:" label being slightly misplaced
in clutter_actor_real_apply_transform().

This works properly:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);

This results in the actor being moved to the pivot-point position:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_matrix_init_identity(&matrix);
  cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
  clutter_actor_set_transform (actor, &matrix);

This also add a conformance test checking that even when using a
pivot-point, no matter how a rotation is set the resulting
transformation matrix will be the same.