[mutter/gbsneto/graphene-matrix: 18/73] cogl/matrix: Multiply using graphene matrices




commit c7cf857221acbf60d516fad0fdfec5a317b2ee0f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 10 10:34:15 2020 -0300

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

 cogl/cogl/cogl-matrix.c | 32 +++++++++++---------------------
 1 file changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 4f65b16cf9..d191bed9e9 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -326,32 +326,22 @@ matrix_multiply_array_with_flags (CoglMatrix *result,
     matrix_multiply4x4 ((float *)result, (float *)result, array);
 }
 
-/* Joins both flags and marks the type and inverse as dirty.  Calls
- * matrix_multiply3x4() if both matrices are 3D, or matrix_multiply4x4()
- * otherwise.
- */
-static void
-_cogl_matrix_multiply (CoglMatrix *result,
-                       const CoglMatrix *a,
-                       const CoglMatrix *b)
-{
-  result->flags = (a->flags |
-                   b->flags |
-                   MAT_DIRTY_TYPE |
-                   MAT_DIRTY_INVERSE);
-
-  if (TEST_MAT_FLAGS(result, MAT_FLAGS_3D))
-    matrix_multiply3x4 ((float *)result, (float *)a, (float *)b);
-  else
-    matrix_multiply4x4 ((float *)result, (float *)a, (float *)b);
-}
-
 void
 cogl_matrix_multiply (CoglMatrix *result,
                      const CoglMatrix *a,
                      const CoglMatrix *b)
 {
-  _cogl_matrix_multiply (result, a, b);
+  graphene_matrix_t res;
+  graphene_matrix_t ma;
+  graphene_matrix_t mb;
+
+  cogl_matrix_to_graphene_matrix (a, &ma);
+  cogl_matrix_to_graphene_matrix (b, &mb);
+  graphene_matrix_multiply (&mb, &ma, &res);
+  graphene_matrix_to_cogl_matrix (&res, result);
+
+  result->flags = a->flags | b->flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE;
+
   _COGL_MATRIX_DEBUG_PRINT (result);
 }
 


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