diff options
author | Robert Bragg <robert@linux.intel.com> | 2009-10-26 17:51:34 +0000 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2009-11-04 03:34:05 +0000 |
commit | 28c7e940bf322f96233534f6b769ccd1bcd3b14e (patch) | |
tree | a00f04a22baa902c59ffa8dbca8b79d89a1686c2 /cogl/cogl-matrix-stack.c | |
parent | 2126bf60fde7d0d1944fe217adb9eab17179493b (diff) | |
download | cogl-28c7e940bf322f96233534f6b769ccd1bcd3b14e.tar.gz |
[matrix] Adds cogl_matrix_get_inverse API
This new API takes advantage of the recently imported Mesa code to support
inverse matrix calculation. The matrix code keeps track (via internal
flags) of the transformations a matrix represents so that it can select an
optimized inversion function.
Note: although other aspects of the Cogl matrix API have followed a similar
style to Cairo's matrix API we haven't added a cogl_matrix_invert API
because the inverse of a CoglMatrix is actually cached as part of the
CoglMatrix structure meaning a destructive API like cogl_matrix_invert
doesn't let users take advantage of this caching design.
Diffstat (limited to 'cogl/cogl-matrix-stack.c')
-rw-r--r-- | cogl/cogl-matrix-stack.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c index 4e2269db..c6236efd 100644 --- a/cogl/cogl-matrix-stack.c +++ b/cogl/cogl-matrix-stack.c @@ -348,6 +348,17 @@ _cogl_matrix_stack_ortho (CoglMatrixStack *stack, state->is_identity = FALSE; } +gboolean +_cogl_matrix_stack_get_inverse (CoglMatrixStack *stack, + CoglMatrix *inverse) +{ + CoglMatrixState *state; + + state = _cogl_matrix_stack_top_mutable (stack, TRUE); + + return cogl_matrix_get_inverse (&state->matrix, inverse); +} + void _cogl_matrix_stack_get (CoglMatrixStack *stack, CoglMatrix *matrix) |