[mutter/gbsneto/graphene-matrix: 31/71] cogl/matrix: Get value using graphene matrix




commit 547a686bc953732aaeb08ca9d10cae14fad63348
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 10 14:45:22 2020 -0300

    cogl/matrix: Get value using graphene matrix
    
    This is another case where we have to swap row and column due to
    matrix ordering differences.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439

 cogl/cogl/cogl-matrix.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 81b6c0cdbe..64d6bbb0e0 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -273,19 +273,6 @@ cogl_debug_matrix_print (const CoglMatrix *matrix)
   _cogl_matrix_prefix_print ("", matrix);
 }
 
-/*
- * References an element of 4x4 matrix.
- *
- * @m matrix array.
- * @c column of the desired element.
- * @r row of the desired element.
- *
- * Returns: value of the desired element.
- *
- * Calculate the linear storage index of the element and references it.
- */
-#define MAT(m,r,c) (m)[(c)*4+(r)]
-
 /*
  * Compute inverse of a transformation matrix.
  *
@@ -705,7 +692,10 @@ cogl_matrix_get_value (const CoglMatrix *matrix,
                        unsigned int      row,
                        unsigned int      column)
 {
-  return MAT ((float *)matrix, row, column);
+  graphene_matrix_t m;
+
+  cogl_matrix_to_graphene_matrix (matrix, &m);
+  return graphene_matrix_get_value (&m, column, row);
 }
 
 void


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