[cogl/wip/rib/master-next: 36/36] matrix: check DIRTY_TYPE flag in _cogl_matrix_print
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rib/master-next: 36/36] matrix: check DIRTY_TYPE flag in _cogl_matrix_print
- Date: Mon, 17 Oct 2011 12:48:17 +0000 (UTC)
commit 886da152bc58936798c2bcf2afaa784136056417
Author: Robert Bragg <robert linux intel com>
Date: Mon Oct 17 10:19:10 2011 +0100
matrix: check DIRTY_TYPE flag in _cogl_matrix_print
when printing a matrix we aim to print out the matrix type but we
weren't checking the flags first to see if the type is valid. We now
check for the DIRTY_TYPE flag and if not set we also validate the matrix
type isn't out of range.
cogl/cogl-matrix.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c
index 0d0cf44..0be6023 100644
--- a/cogl/cogl-matrix.c
+++ b/cogl/cogl-matrix.c
@@ -108,7 +108,8 @@ enum CoglMatrixType {
COGL_MATRIX_TYPE_PERSPECTIVE, /**< perspective projection matrix */
COGL_MATRIX_TYPE_2D, /**< 2-D transformation */
COGL_MATRIX_TYPE_2D_NO_ROT, /**< 2-D scale & translate only */
- COGL_MATRIX_TYPE_3D /**< 3-D transformation */
+ COGL_MATRIX_TYPE_3D, /**< 3-D transformation */
+ COGL_MATRIX_N_TYPES
} ;
#define DEG2RAD (G_PI/180.0)
@@ -373,8 +374,15 @@ print_matrix_floats (const float m[16])
void
_cogl_matrix_print (const CoglMatrix *matrix)
{
- g_print ("Matrix type: %s, flags: %x\n",
- types[matrix->type], (int)matrix->flags);
+ if (!matrix->flags & MAT_DIRTY_TYPE)
+ {
+ g_return_if_fail (matrix->type < COGL_MATRIX_N_TYPES);
+ g_print ("Matrix type: %s, flags: %x\n",
+ types[matrix->type], (int)matrix->flags);
+ }
+ else
+ g_print ("Matrix type: DIRTY, flags: %x\n", (int)matrix->flags);
+
print_matrix_floats ((float *)matrix);
g_print ("Inverse: \n");
if (!(matrix->flags & MAT_DIRTY_INVERSE))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]