cogl/matrix: Skew using graphene matrices

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-10 11:59:46 -03:00
parent 3ea8af1489
commit 5d84f73aa0

View File

@ -1946,12 +1946,15 @@ void
cogl_matrix_skew_xy (CoglMatrix *matrix, cogl_matrix_skew_xy (CoglMatrix *matrix,
float factor) float factor)
{ {
matrix->yx += matrix->xx * factor; graphene_matrix_t skew;
matrix->yy += matrix->xy * factor; graphene_matrix_t m;
matrix->yz += matrix->xz * factor;
matrix->yw += matrix->xw * factor; cogl_matrix_to_graphene_matrix (matrix, &m);
graphene_matrix_init_identity (&skew);
graphene_matrix_skew_xy (&skew, factor);
graphene_matrix_multiply (&skew, &m, &m);
graphene_matrix_to_cogl_matrix (&m, matrix);
matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL);
_COGL_MATRIX_DEBUG_PRINT (matrix); _COGL_MATRIX_DEBUG_PRINT (matrix);
} }
@ -1959,12 +1962,15 @@ void
cogl_matrix_skew_xz (CoglMatrix *matrix, cogl_matrix_skew_xz (CoglMatrix *matrix,
float factor) float factor)
{ {
matrix->zx += matrix->xx * factor; graphene_matrix_t skew;
matrix->zy += matrix->xy * factor; graphene_matrix_t m;
matrix->zz += matrix->xz * factor;
matrix->zw += matrix->xw * factor; cogl_matrix_to_graphene_matrix (matrix, &m);
graphene_matrix_init_identity (&skew);
graphene_matrix_skew_xz (&skew, factor);
graphene_matrix_multiply (&skew, &m, &m);
graphene_matrix_to_cogl_matrix (&m, matrix);
matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL);
_COGL_MATRIX_DEBUG_PRINT (matrix); _COGL_MATRIX_DEBUG_PRINT (matrix);
} }
@ -1972,11 +1978,14 @@ void
cogl_matrix_skew_yz (CoglMatrix *matrix, cogl_matrix_skew_yz (CoglMatrix *matrix,
float factor) float factor)
{ {
matrix->zx += matrix->yx * factor; graphene_matrix_t skew;
matrix->zy += matrix->yy * factor; graphene_matrix_t m;
matrix->zz += matrix->yz * factor;
matrix->zw += matrix->yw * factor; cogl_matrix_to_graphene_matrix (matrix, &m);
graphene_matrix_init_identity (&skew);
graphene_matrix_skew_yz (&skew, factor);
graphene_matrix_multiply (&skew, &m, &m);
graphene_matrix_to_cogl_matrix (&m, matrix);
matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL);
_COGL_MATRIX_DEBUG_PRINT (matrix); _COGL_MATRIX_DEBUG_PRINT (matrix);
} }