1
0
Fork 0

matrix: Adds cogl_matrix_is_identity API

This adds a function called cogl_matrix_is_identity that can determine
if a given matrix is an identity matrix or not.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-06-30 22:15:08 +01:00
parent 8bfde524f8
commit d74cf9de81
4 changed files with 24 additions and 0 deletions

View file

@ -2041,3 +2041,13 @@ cogl_matrix_project_points (const CoglMatrix *matrix,
n_points);
}
}
gboolean
cogl_matrix_is_identity (const CoglMatrix *matrix)
{
if (!(matrix->flags & MAT_DIRTY_TYPE) &&
matrix->type == COGL_MATRIX_TYPE_IDENTITY)
return TRUE;
else
return memcmp (matrix, identity, sizeof (float) * 16) == 0;
}

View file

@ -585,6 +585,18 @@ cogl_matrix_project_points (const CoglMatrix *matrix,
#endif /* COGL_ENABLE_EXPERIMENTAL_API */
/**
* cogl_matrix_is_identity:
* @matrix: A #CoglMatrix
*
* Determines if the given matrix is an identity matrix.
*
* Returns: %TRUE if @matrix is an identity matrix else %FALSE
* Since: 1.8
*/
gboolean
cogl_matrix_is_identity (const CoglMatrix *matrix);
#ifdef _COGL_SUPPORTS_GTYPE_INTEGRATION
#define COGL_GTYPE_TYPE_MATRIX (cogl_gtype_matrix_get_type ())

View file

@ -387,6 +387,7 @@ cogl_matrix_scale
cogl_matrix_init_from_array
cogl_matrix_get_array
cogl_matrix_get_inverse
cogl_matrix_is_identity
</SECTION>
<FILE>cogl-euler</FILE>

View file

@ -469,6 +469,7 @@ cogl_matrix_get_inverse
cogl_matrix_transform_point
cogl_matrix_project_points
cogl_matrix_transform_points
cogl_matrix_is_identity
</SECTION>
<SECTION>