mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
cogl/matrix: Add graphene_matrix_t utility function
CoglMatrix doesn't have a 1:1 mapping of graphene functions, and sometimes it's just not worth adding wrappers over it. It is easier to expose the internal graphene_matrix_t and let callers use it directly. Add new cogl_matrix_get_graphene_matrix() helper function, and simplify Clutter's matrix progress function. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
parent
6c695ec39d
commit
2e986ed3e8
@ -37,18 +37,14 @@ cogl_matrix_progress (const GValue *a,
|
||||
{
|
||||
const CoglMatrix *matrix1 = g_value_get_boxed (a);
|
||||
const CoglMatrix *matrix2 = g_value_get_boxed (b);
|
||||
graphene_matrix_t m1, m2, interpolated;
|
||||
graphene_matrix_t interpolated;
|
||||
CoglMatrix res;
|
||||
float fm1[16];
|
||||
float fm2[16];
|
||||
float v[16];
|
||||
|
||||
cogl_matrix_to_float (matrix1, fm1);
|
||||
cogl_matrix_to_float (matrix2, fm2);
|
||||
|
||||
graphene_matrix_init_from_float (&m1, fm1);
|
||||
graphene_matrix_init_from_float (&m2, fm2);
|
||||
graphene_matrix_interpolate (&m1, &m2, progress, &interpolated);
|
||||
graphene_matrix_interpolate (cogl_matrix_get_graphene_matrix (matrix1),
|
||||
cogl_matrix_get_graphene_matrix (matrix2),
|
||||
progress,
|
||||
&interpolated);
|
||||
graphene_matrix_to_float (&interpolated, v);
|
||||
|
||||
cogl_matrix_init_from_array (&res, v);
|
||||
|
@ -810,3 +810,9 @@ cogl_matrix_skew_yz (CoglMatrix *matrix,
|
||||
matrix->flags |= COGL_MATRIX_FLAG_DIRTY_INVERSE;
|
||||
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
||||
}
|
||||
|
||||
const graphene_matrix_t *
|
||||
cogl_matrix_get_graphene_matrix (const CoglMatrix *matrix)
|
||||
{
|
||||
return &matrix->m;
|
||||
}
|
||||
|
@ -777,6 +777,18 @@ COGL_EXPORT void
|
||||
cogl_matrix_skew_yz (CoglMatrix *matrix,
|
||||
float factor);
|
||||
|
||||
/**
|
||||
* cogl_matrix_get_graphene_matrix:
|
||||
* @matrix: a #CoglMatrix
|
||||
*
|
||||
* Retrieves the internal #graphene_matrix_t of @matrix. It should not
|
||||
* be modified, and must be considered read-only.
|
||||
*
|
||||
* Returns: (transfer none): a #graphene_matrix_t
|
||||
*/
|
||||
COGL_EXPORT const graphene_matrix_t *
|
||||
cogl_matrix_get_graphene_matrix (const CoglMatrix *matrix);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_MATRIX_H */
|
||||
|
Loading…
Reference in New Issue
Block a user