mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
cogl/matrix: Get value using graphene matrix
Internally, a graphene_matrix_t representing the same transform that of a CoglMatrix is the same matrix but transposed, so in order to get the same element given a column and row for a matrix as if it would be located in Cogl, it is necessary to swap the row and column when retrieving it from the graphene matrix. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
parent
45f3e15b63
commit
a96f0d7537
@ -273,19 +273,6 @@ cogl_debug_matrix_print (const CoglMatrix *matrix)
|
||||
_cogl_matrix_prefix_print ("", matrix);
|
||||
}
|
||||
|
||||
/*
|
||||
* References an element of 4x4 matrix.
|
||||
*
|
||||
* @m matrix array.
|
||||
* @c column of the desired element.
|
||||
* @r row of the desired element.
|
||||
*
|
||||
* Returns: value of the desired element.
|
||||
*
|
||||
* Calculate the linear storage index of the element and references it.
|
||||
*/
|
||||
#define MAT(m,r,c) (m)[(c)*4+(r)]
|
||||
|
||||
/*
|
||||
* Compute inverse of a transformation matrix.
|
||||
*
|
||||
@ -729,7 +716,10 @@ cogl_matrix_get_value (const CoglMatrix *matrix,
|
||||
unsigned int row,
|
||||
unsigned int column)
|
||||
{
|
||||
return MAT ((float *)matrix, row, column);
|
||||
graphene_matrix_t m;
|
||||
|
||||
cogl_matrix_to_graphene_matrix (matrix, &m);
|
||||
return graphene_matrix_get_value (&m, column, row);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user