[cogl] cogl-matrix-stack: Adds _cogl_matrix_stack_equal



commit 595311ba557d47dbf4f21b95355ab221acded996
Author: Robert Bragg <robert linux intel com>
Date:   Mon Nov 21 15:49:58 2011 +0000

    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>

 cogl/cogl-matrix-stack.c |   16 ++++++++++++++++
 cogl/cogl-matrix-stack.h |    4 ++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c
index 09aa002..1c68654 100644
--- a/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl-matrix-stack.c
@@ -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);
+}
diff --git a/cogl/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h
index 3368f1b..45aeaa8 100644
--- a/cogl/cogl-matrix-stack.h
+++ b/cogl/cogl-matrix-stack.h
@@ -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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]