[mutter/gbsneto/graphene-matrix: 5/73] cogl/matrix: Add cogl_matrix_init_from_matrix initializer
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene-matrix: 5/73] cogl/matrix: Add cogl_matrix_init_from_matrix initializer
- Date: Tue, 6 Oct 2020 15:34:51 +0000 (UTC)
commit a761caf07978681398271b3ef3333d1a21443a39
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Sep 8 20:16:26 2020 -0300
cogl/matrix: Add cogl_matrix_init_from_matrix initializer
It does a simple memcpy() to clone the entire structure. This will
be necessary for a smoother removal of ClutterMatrix.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
cogl/cogl/cogl-matrix.c | 7 +++++++
cogl/cogl/cogl-matrix.h | 11 +++++++++++
2 files changed, 18 insertions(+)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 695887a70a..7bd2af0b08 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -1700,6 +1700,13 @@ cogl_matrix_init_from_array (CoglMatrix *matrix, const float *array)
_COGL_MATRIX_DEBUG_PRINT (matrix);
}
+void
+cogl_matrix_init_from_matrix (CoglMatrix *matrix,
+ const CoglMatrix *source)
+{
+ memcpy (matrix, source, sizeof (CoglMatrix));
+}
+
void
_cogl_matrix_init_from_matrix_without_inverse (CoglMatrix *matrix,
const CoglMatrix *src)
diff --git a/cogl/cogl/cogl-matrix.h b/cogl/cogl/cogl-matrix.h
index 5e0a5498ea..2cfd95bbb2 100644
--- a/cogl/cogl/cogl-matrix.h
+++ b/cogl/cogl/cogl-matrix.h
@@ -463,6 +463,17 @@ COGL_EXPORT void
cogl_matrix_init_from_array (CoglMatrix *matrix,
const float *array);
+/**
+ * cogl_matrix_init_from_matrix:
+ * @matrix: A 4x4 transformation matrix
+ * @source: the #CoglMatrix to copy
+ *
+ * Initializes @matrix with the contents of @source
+ */
+COGL_EXPORT void
+cogl_matrix_init_from_matrix (CoglMatrix *matrix,
+ const CoglMatrix *source);
+
/**
* cogl_matrix_get_array:
* @matrix: A 4x4 transformation matrix
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]