[mutter/gbsneto/graphene-matrix: 29/87] cogl/matrix: Add cogl_matrix_get_value
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene-matrix: 29/87] cogl/matrix: Add cogl_matrix_get_value
- Date: Sat, 19 Sep 2020 23:54:26 +0000 (UTC)
commit 8ccc81f588f5b4bf5b89a5ea18e2509b14bbb51c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Sep 9 22:15:35 2020 -0300
cogl/matrix: Add cogl_matrix_get_value
This will allow us stop accessing members of the structure
directly. Also mark all struct members as private.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
cogl/cogl/cogl-matrix.c | 8 ++++++++
cogl/cogl/cogl-matrix.h | 15 +++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 17ee499dde..9e4e52de9a 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -1941,6 +1941,14 @@ cogl_matrix_get_array (const CoglMatrix *matrix)
return (float *)matrix;
}
+float
+cogl_matrix_get_value (const CoglMatrix *matrix,
+ unsigned int row,
+ unsigned int column)
+{
+ return MAT ((float *)matrix, row, column);
+}
+
void
cogl_matrix_transform_point (const CoglMatrix *matrix,
float *x,
diff --git a/cogl/cogl/cogl-matrix.h b/cogl/cogl/cogl-matrix.h
index 4b5eef699f..03dd3e3fae 100644
--- a/cogl/cogl/cogl-matrix.h
+++ b/cogl/cogl/cogl-matrix.h
@@ -86,6 +86,8 @@ G_BEGIN_DECLS
*/
struct _CoglMatrix
{
+ /*< private >*/
+
/* column 0 */
float xx;
float yx;
@@ -110,8 +112,6 @@ struct _CoglMatrix
float zw;
float ww;
- /*< private >*/
-
/* Note: we may want to extend this later with private flags
* and a cache of the inverse transform matrix. */
float COGL_PRIVATE (inv)[16];
@@ -491,6 +491,17 @@ cogl_matrix_init_from_matrix (CoglMatrix *matrix,
COGL_EXPORT const float *
cogl_matrix_get_array (const CoglMatrix *matrix);
+/**
+ * cogl_matrix_get_value:
+ * @matrix: A 4x4 transformation matrix
+ *
+ *
+ */
+COGL_EXPORT float
+cogl_matrix_get_value (const CoglMatrix *matrix,
+ unsigned int row,
+ unsigned int column);
+
/**
* cogl_matrix_init_from_euler:
* @matrix: A 4x4 transformation matrix
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]