mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
37bd35f592
Currently, the transformation matrix for an actor is constructed from scenegraph-related accessors. An actor, though, can call COGL API to add new transformations inside the paint() implementation, for instance: static void my_foo_paint (ClutterActor *a) { ... cogl_translate (-scroll_x, -scroll_y, 0); ... } Unfortunately these transformations will be completely ignored by the scenegraph machinery; for instance, getting the actor-relative coordinates from event coordinates is going to break badly because of this. In order to make the scenegraph aware of the potential of additional transformations, we need a ::apply_transform() virtual function. This vfunc will pass a CoglMatrix which can be used to apply additional operations: static void my_foo_apply_transform (ClutterActor *a, CoglMatrix *m) { CLUTTER_ACTOR_CLASS (my_foo_parent_class)->apply_transform (a, m); ... cogl_matrix_translate (m, -scroll_x, -scroll_y, 0); ... } The ::paint() implementation will be called with the actor already using the newly applied transformation matrix, as expected: static void my_foo_paint (ClutterActor *a) { ... } The ::apply_transform() implementations *must* chain up, so that the various transformations of each class are preserved. The default implementation inside ClutterActor applies all the transformations defined by the scenegraph-related accessors. Actors performing transformations inside the paint() function will continue to work as previously. |
||
---|---|---|
.. | ||
clutter | ||
cogl | ||
ChangeLog | ||
Makefile.am |