mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl/matrix: Scale using Graphene
It sucks that we have to double transpose the matrix.
This commit is contained in:
parent
bb257868f3
commit
ecee159113
@ -555,31 +555,22 @@ cogl_matrix_orthographic (CoglMatrix *matrix,
|
|||||||
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Multiply a matrix with a general scaling matrix.
|
|
||||||
*
|
|
||||||
* Multiplies in-place the elements of matrix by the scale factors. Checks if
|
|
||||||
* the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE
|
|
||||||
* flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and
|
|
||||||
* MAT_DIRTY_INVERSE dirty flags.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
_cogl_matrix_scale (CoglMatrix *matrix, float x, float y, float z)
|
|
||||||
{
|
|
||||||
float *m = (float *)matrix;
|
|
||||||
m[0] *= x; m[4] *= y; m[8] *= z;
|
|
||||||
m[1] *= x; m[5] *= y; m[9] *= z;
|
|
||||||
m[2] *= x; m[6] *= y; m[10] *= z;
|
|
||||||
m[3] *= x; m[7] *= y; m[11] *= z;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_matrix_scale (CoglMatrix *matrix,
|
cogl_matrix_scale (CoglMatrix *matrix,
|
||||||
float sx,
|
float sx,
|
||||||
float sy,
|
float sy,
|
||||||
float sz)
|
float sz)
|
||||||
{
|
{
|
||||||
_cogl_matrix_scale (matrix, sx, sy, sz);
|
graphene_matrix_t m;
|
||||||
|
|
||||||
|
cogl_matrix_to_graphene_matrix (matrix, &m);
|
||||||
|
|
||||||
|
graphene_matrix_transpose (&m, &m);
|
||||||
|
graphene_matrix_scale (&m, sx, sy, sz);
|
||||||
|
graphene_matrix_transpose (&m, &m);
|
||||||
|
|
||||||
|
graphene_matrix_to_cogl_matrix (&m, matrix);
|
||||||
|
|
||||||
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
_COGL_MATRIX_DEBUG_PRINT (matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user