From 35b07f6b8394c0ca371183f9bd2709812c884754 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 10 Dec 2010 17:42:39 +0000 Subject: [PATCH] cogl-matrix-stack: Add _cogl_matrix_stack_has_identity_flag This adds an internal function to quickly determine whether the top of the matrix stack is known to be the identity matrix. --- cogl/cogl-matrix-stack.c | 6 ++++++ cogl/cogl-matrix-stack.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c index 7b4ad69f8..d4defd1ce 100644 --- a/cogl/cogl-matrix-stack.c +++ b/cogl/cogl-matrix-stack.c @@ -473,3 +473,9 @@ _cogl_matrix_stack_get_age (CoglMatrixStack *stack) { return stack->age; } + +gboolean +_cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack) +{ + return _cogl_matrix_stack_top (stack)->is_identity; +} diff --git a/cogl/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h index 8efca3fed..5c8b954a1 100644 --- a/cogl/cogl-matrix-stack.h +++ b/cogl/cogl-matrix-stack.h @@ -110,4 +110,11 @@ _cogl_matrix_stack_dirty (CoglMatrixStack *stack); unsigned int _cogl_matrix_stack_get_age (CoglMatrixStack *stack); +/* If this returns TRUE then the top of the matrix is definitely the + identity matrix. If it returns FALSE it may or may not be the + identity matrix but no expensive comparison is performed to verify + it. */ +gboolean +_cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack); + #endif /* __COGL_MATRIX_STACK_H */