summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/matrix.c')
-rw-r--r--src/mesa/main/matrix.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index 5eb5bb43f0c..5db2542a6e8 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -1,4 +1,4 @@
-/* $Id: matrix.c,v 1.17 2000/04/08 18:57:45 brianp Exp $ */
+/* $Id: matrix.c,v 1.18 2000/06/27 22:10:00 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1562,16 +1562,23 @@ void gl_calculate_model_project_matrix( GLcontext *ctx )
void gl_matrix_ctr( GLmatrix *m )
{
+ if ( m->m == 0 ) {
+ m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
+ }
+ MEMCPY( m->m, Identity, sizeof(Identity) );
m->inv = 0;
- MEMCPY( m->m, Identity, sizeof(Identity));
m->type = MATRIX_IDENTITY;
m->flags = MAT_DIRTY_DEPENDENTS;
}
void gl_matrix_dtr( GLmatrix *m )
{
- if (m->inv != 0) {
- FREE(m->inv);
+ if ( m->m != 0 ) {
+ ALIGN_FREE( m->m );
+ m->m = 0;
+ }
+ if ( m->inv != 0 ) {
+ ALIGN_FREE( m->inv );
m->inv = 0;
}
}
@@ -1579,7 +1586,7 @@ void gl_matrix_dtr( GLmatrix *m )
#if 0
void gl_matrix_set_identity( GLmatrix *m )
{
- MEMCPY( m->m, Identity, sizeof(Identity));
+ MEMCPY( m->m, Identity, sizeof(Identity) );
m->type = MATRIX_IDENTITY;
m->flags = MAT_DIRTY_DEPENDENTS;
}
@@ -1587,15 +1594,15 @@ void gl_matrix_set_identity( GLmatrix *m )
void gl_matrix_alloc_inv( GLmatrix *m )
{
- if (m->inv == 0) {
- m->inv = (GLfloat *)MALLOC(16*sizeof(GLfloat));
+ if ( m->inv == 0 ) {
+ m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 );
MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) );
}
}
void gl_matrix_copy( GLmatrix *to, const GLmatrix *from )
{
- MEMCPY( to->m, from->m, sizeof(Identity));
+ MEMCPY( to->m, from->m, sizeof(Identity) );
to->flags = from->flags | MAT_DIRTY_DEPENDENTS;
to->type = from->type;