matrix: Adds matrix_copy and _free functions
As a pre-requisite for being able to register a boxed GType for CoglMatrix (enabling us to define gobject properties that accept a CoglMatrix) this adds cogl_matrix_copy and _free functions.
This commit is contained in:
parent
98dd3f723c
commit
3ac023163f
@ -353,6 +353,21 @@ cogl_matrix_equal (gconstpointer v1, gconstpointer v2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CoglMatrix *
|
||||
cogl_matrix_copy (const CoglMatrix *matrix)
|
||||
{
|
||||
if (G_LIKELY (matrix))
|
||||
return g_slice_dup (CoglMatrix, matrix);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_matrix_free (CoglMatrix *matrix)
|
||||
{
|
||||
g_slice_free (CoglMatrix, matrix);
|
||||
}
|
||||
|
||||
const float *
|
||||
cogl_matrix_get_array (const CoglMatrix *matrix)
|
||||
{
|
||||
|
@ -292,6 +292,33 @@ cogl_matrix_get_array (const CoglMatrix *matrix);
|
||||
gboolean
|
||||
cogl_matrix_equal (gconstpointer v1, gconstpointer v2);
|
||||
|
||||
/**
|
||||
* cogl_matrix_copy:
|
||||
* @matrix: A 4x4 transformation matrix you want to copy
|
||||
*
|
||||
* Allocates a new #CoglMatrix on the heap and initializes it with
|
||||
* the same values as @matrix.
|
||||
*
|
||||
* Returns: A newly allocated #CoglMatrix which should be freed using
|
||||
* cogl_matrix_free()
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
CoglMatrix *
|
||||
cogl_matrix_copy (const CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_matrix_free:
|
||||
* @matrix: A 4x4 transformation matrix you want to free
|
||||
*
|
||||
* Frees a #CoglMatrix that was previously allocated via a call to
|
||||
* cogl_matrix_copy().
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
cogl_matrix_free (CoglMatrix *matrix);
|
||||
|
||||
/**
|
||||
* cogl_matrix_get_inverse:
|
||||
* @matrix: A 4x4 transformation matrix
|
||||
|
Loading…
Reference in New Issue
Block a user