clutter/actor: Publish get_relative_transformation_matrix

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
This commit is contained in:
msizanoen1 2022-12-03 13:34:07 +07:00 committed by Marge Bot
parent ae403f2e94
commit ab835787bd
2 changed files with 17 additions and 16 deletions

View File

@ -1038,10 +1038,6 @@ static void clutter_actor_update_map_state (ClutterActor *self,
MapStateChange change); MapStateChange change);
static void clutter_actor_unrealize_not_hiding (ClutterActor *self); static void clutter_actor_unrealize_not_hiding (ClutterActor *self);
static void _clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
ClutterActor *ancestor,
graphene_matrix_t *matrix);
static ClutterPaintVolume *_clutter_actor_get_paint_volume_mutable (ClutterActor *self); static ClutterPaintVolume *_clutter_actor_get_paint_volume_mutable (ClutterActor *self);
static guint8 clutter_actor_get_paint_opacity_internal (ClutterActor *self); static guint8 clutter_actor_get_paint_opacity_internal (ClutterActor *self);
@ -2767,7 +2763,7 @@ clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
return; return;
} }
_clutter_actor_get_relative_transformation_matrix (self, ancestor, &matrix); clutter_actor_get_relative_transformation_matrix (self, ancestor, &matrix);
cogl_graphene_matrix_project_point (&matrix, cogl_graphene_matrix_project_point (&matrix,
&vertex->x, &vertex->x,
&vertex->y, &vertex->y,
@ -2798,7 +2794,7 @@ _clutter_actor_fully_transform_vertices (ClutterActor *self,
/* Note: we pass NULL as the ancestor because we don't just want the modelview /* Note: we pass NULL as the ancestor because we don't just want the modelview
* that gets us to stage coordinates, we want to go all the way to eye * that gets us to stage coordinates, we want to go all the way to eye
* coordinates */ * coordinates */
_clutter_actor_get_relative_transformation_matrix (self, NULL, &modelview); clutter_actor_get_relative_transformation_matrix (self, NULL, &modelview);
/* Fetch the projection and viewport */ /* Fetch the projection and viewport */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (stage), &projection); _clutter_stage_get_projection_matrix (CLUTTER_STAGE (stage), &projection);
@ -2838,12 +2834,12 @@ clutter_actor_apply_transform_to_point (ClutterActor *self,
_clutter_actor_fully_transform_vertices (self, point, vertex, 1); _clutter_actor_fully_transform_vertices (self, point, vertex, 1);
} }
/* /**
* _clutter_actor_get_relative_transformation_matrix: * clutter_actor_get_relative_transformation_matrix:
* @self: The actor whose coordinate space you want to transform from. * @self: The actor whose coordinate space you want to transform from.
* @ancestor: The ancestor actor whose coordinate space you want to transform too * @ancestor: (nullable): The ancestor actor whose coordinate space you want to transform to
* or %NULL if you want to transform all the way to eye coordinates. * or %NULL if you want to transform all the way to eye coordinates.
* @matrix: A #graphene_matrix_t to store the transformation * @matrix: (out caller-allocates): A #graphene_matrix_t to store the transformation
* *
* This gets a transformation @matrix that will transform coordinates from the * This gets a transformation @matrix that will transform coordinates from the
* coordinate space of @self into the coordinate space of @ancestor. * coordinate space of @self into the coordinate space of @ancestor.
@ -2867,8 +2863,8 @@ clutter_actor_apply_transform_to_point (ClutterActor *self,
*/ */
/* XXX: We should consider caching the stage relative modelview along with /* XXX: We should consider caching the stage relative modelview along with
* the actor itself */ * the actor itself */
static void void
_clutter_actor_get_relative_transformation_matrix (ClutterActor *self, clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
ClutterActor *ancestor, ClutterActor *ancestor,
graphene_matrix_t *matrix) graphene_matrix_t *matrix)
{ {
@ -3705,7 +3701,7 @@ clutter_actor_paint (ClutterActor *self,
{ {
graphene_matrix_t expected_matrix; graphene_matrix_t expected_matrix;
_clutter_actor_get_relative_transformation_matrix (self, NULL, clutter_actor_get_relative_transformation_matrix (self, NULL,
&expected_matrix); &expected_matrix);
if (!graphene_matrix_equal_fast (&transform, &expected_matrix)) if (!graphene_matrix_equal_fast (&transform, &expected_matrix))

View File

@ -135,6 +135,11 @@ void clutter_get_debug_flags (ClutterDebugFlag *debug_flags,
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_notify_transform_invalid (ClutterActor *self); void clutter_actor_notify_transform_invalid (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_get_relative_transformation_matrix (ClutterActor *self,
ClutterActor *ancestor,
graphene_matrix_t *matrix);
#undef __CLUTTER_H_INSIDE__ #undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */ #endif /* __CLUTTER_MUTTER_H__ */