summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-03-01 13:28:13 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-03-20 15:17:14 +0000
commit2ed596088f31878d3018af63d0b144b8ab7e7cf5 (patch)
treedaf3e753070e86fdf12f5716b2fb3cd4d72ee2e7
parent7f708ce39e0b7532d30be6313957dc41600384a7 (diff)
downloadmutter-2ed596088f31878d3018af63d0b144b8ab7e7cf5.tar.gz
cogl/matrix: Translate using Graphene
-rw-r--r--cogl/cogl/cogl-matrix.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 282ed48e4..1e427bbb8 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -276,30 +276,18 @@ cogl_matrix_scale (CoglMatrix *matrix,
_COGL_MATRIX_DEBUG_PRINT (matrix);
}
-/*
- * Multiply a matrix with a translation matrix.
- *
- * Adds the translation coordinates to the elements of matrix in-place. Marks
- * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE
- * dirty flags.
- */
-static void
-_cogl_matrix_translate (CoglMatrix *matrix, float x, float y, float z)
-{
- float *m = (float *)matrix;
- m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
- m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
- m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
- m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
-}
-
void
cogl_matrix_translate (CoglMatrix *matrix,
float x,
float y,
float z)
{
- _cogl_matrix_translate (matrix, x, y, z);
+ graphene_matrix_t m;
+
+ cogl_matrix_to_graphene_matrix (matrix, &m);
+ graphene_matrix_translate (&m, &GRAPHENE_POINT3D_INIT (x, y, z));
+ graphene_matrix_to_cogl_matrix (&m, matrix);
+
_COGL_MATRIX_DEBUG_PRINT (matrix);
}