cogl/matrix: Add cogl_matrix_init_from_matrix initializer

It does a simple memcpy() to clone the entire structure. This will
be necessary for a smoother removal of ClutterMatrix.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-08 20:16:26 -03:00
parent c2dbdb3703
commit a761caf079
2 changed files with 18 additions and 0 deletions

View File

@ -1700,6 +1700,13 @@ cogl_matrix_init_from_array (CoglMatrix *matrix, const float *array)
_COGL_MATRIX_DEBUG_PRINT (matrix); _COGL_MATRIX_DEBUG_PRINT (matrix);
} }
void
cogl_matrix_init_from_matrix (CoglMatrix *matrix,
const CoglMatrix *source)
{
memcpy (matrix, source, sizeof (CoglMatrix));
}
void void
_cogl_matrix_init_from_matrix_without_inverse (CoglMatrix *matrix, _cogl_matrix_init_from_matrix_without_inverse (CoglMatrix *matrix,
const CoglMatrix *src) const CoglMatrix *src)

View File

@ -463,6 +463,17 @@ COGL_EXPORT void
cogl_matrix_init_from_array (CoglMatrix *matrix, cogl_matrix_init_from_array (CoglMatrix *matrix,
const float *array); const float *array);
/**
* cogl_matrix_init_from_matrix:
* @matrix: A 4x4 transformation matrix
* @source: the #CoglMatrix to copy
*
* Initializes @matrix with the contents of @source
*/
COGL_EXPORT void
cogl_matrix_init_from_matrix (CoglMatrix *matrix,
const CoglMatrix *source);
/** /**
* cogl_matrix_get_array: * cogl_matrix_get_array:
* @matrix: A 4x4 transformation matrix * @matrix: A 4x4 transformation matrix