[mutter/gbsneto/graphene-matrix: 6/57] cogl/matrix: Transpose using graphene matrices




commit fc217ad477fb1de9bec82dc9276e7e928f5e975c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 10 10:55:16 2020 -0300

    cogl/matrix: Transpose using graphene matrices
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439

 cogl/cogl/cogl-matrix.c | 36 ++++++------------------------------
 1 file changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 925379e8b5..5494d18fd8 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -1584,30 +1584,6 @@ cogl_matrix_init_from_euler (CoglMatrix *matrix,
   matrix->flags = (MAT_FLAG_GENERAL | MAT_DIRTY_ALL);
 }
 
-/*
- * Transpose a float matrix.
- */
-static void
-_cogl_matrix_util_transposef (float to[16], const float from[16])
-{
-  to[0] = from[0];
-  to[1] = from[4];
-  to[2] = from[8];
-  to[3] = from[12];
-  to[4] = from[1];
-  to[5] = from[5];
-  to[6] = from[9];
-  to[7] = from[13];
-  to[8] = from[2];
-  to[9] = from[6];
-  to[10] = from[10];
-  to[11] = from[14];
-  to[12] = from[3];
-  to[13] = from[7];
-  to[14] = from[11];
-  to[15] = from[15];
-}
-
 void
 cogl_matrix_view_2d_in_frustum (CoglMatrix *matrix,
                                 float left,
@@ -1967,16 +1943,16 @@ cogl_matrix_look_at (CoglMatrix *matrix,
 void
 cogl_matrix_transpose (CoglMatrix *matrix)
 {
-  float new_values[16];
+  graphene_matrix_t m;
+
+  cogl_matrix_to_graphene_matrix (matrix, &m);
 
   /* We don't need to do anything if the matrix is the identity matrix */
-  if (!(matrix->flags & MAT_DIRTY_TYPE) &&
-      matrix->type == COGL_MATRIX_TYPE_IDENTITY)
+  if (graphene_matrix_is_identity (&m))
     return;
 
-  _cogl_matrix_util_transposef (new_values, cogl_matrix_get_array (matrix));
-
-  cogl_matrix_init_from_array (matrix, new_values);
+  graphene_matrix_transpose (&m, &m);
+  graphene_matrix_to_cogl_matrix (&m, matrix);
 }
 
 GType


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]