clutter/stage-view: Add getter for getting the offscreen blit transform

This will be used to invert the transform in the nested mode, making it
possible to test offscreen texture based transform using the nested
backend.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
This commit is contained in:
Jonas Ådahl 2017-03-07 18:02:52 +08:00
parent 615587cd06
commit c5dc0f4a2e
2 changed files with 14 additions and 2 deletions

View File

@ -179,16 +179,24 @@ clutter_stage_view_set_dirty_projection (ClutterStageView *view,
priv->dirty_projection = dirty;
}
void
clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix)
{
ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
view_class->get_offscreen_transformation_matrix (view, matrix);
}
void
clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
gfloat *x,
gfloat *y)
{
ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
gfloat z = 0, w = 1;
CoglMatrix matrix;
view_class->get_offscreen_transformation_matrix (view, &matrix);
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
cogl_matrix_get_inverse (&matrix, &matrix);
cogl_matrix_transform_point (&matrix, x, y, &z, &w);
}

View File

@ -70,4 +70,8 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix);
#endif /* __CLUTTER_STAGE_VIEW_H__ */