cogl-matrix-stack: Adds _cogl_matrix_stack_equal

Adds a function for comparing the top matrix entries of two matrix
stacks.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-11-21 15:49:58 +00:00
parent a4f3d0d18b
commit 595311ba55
2 changed files with 20 additions and 0 deletions

View File

@ -552,3 +552,19 @@ _cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack)
{
return _cogl_matrix_stack_top (stack)->is_identity;
}
gboolean
_cogl_matrix_stack_equal (CoglMatrixStack *stack0,
CoglMatrixStack *stack1)
{
CoglMatrixState *state0 = _cogl_matrix_stack_top (stack0);
CoglMatrixState *state1 = _cogl_matrix_stack_top (stack1);
if (state0->is_identity != state1->is_identity)
return FALSE;
if (state0->is_identity)
return TRUE;
else
return cogl_matrix_equal (&state0->matrix, &state1->matrix);
}

View File

@ -127,4 +127,8 @@ _cogl_matrix_stack_prepare_for_flush (CoglMatrixStack *stack,
CoglMatrixStackFlushFunc callback,
void *user_data);
gboolean
_cogl_matrix_stack_equal (CoglMatrixStack *stack0,
CoglMatrixStack *stack1);
#endif /* __COGL_MATRIX_STACK_H */