[mutter/gbsneto/graphene-matrix: 51/104] cogl/matrix: Compare using graphene matrices
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene-matrix: 51/104] cogl/matrix: Compare using graphene matrices
- Date: Tue, 6 Oct 2020 14:43:26 +0000 (UTC)
commit 3e4eb2b5b71b2fce443c0366ae1c9bea3f9e030c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Sep 10 10:52:19 2020 -0300
cogl/matrix: Compare using graphene matrices
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
cogl/cogl/cogl-matrix.c | 38 +++++---------------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
---
diff --git a/cogl/cogl/cogl-matrix.c b/cogl/cogl/cogl-matrix.c
index 540774d81f..d5bfa6c8e9 100644
--- a/cogl/cogl/cogl-matrix.c
+++ b/cogl/cogl/cogl-matrix.c
@@ -1668,46 +1668,18 @@ cogl_matrix_view_2d_in_perspective (CoglMatrix *matrix,
gboolean
cogl_matrix_equal (const void *v1, const void *v2)
{
+ graphene_matrix_t ma;
+ graphene_matrix_t mb;
const CoglMatrix *a = v1;
const CoglMatrix *b = v2;
g_return_val_if_fail (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE);
- /* We want to avoid having a fuzzy _equal() function (e.g. that uses
- * an arbitrary epsilon value) since this function notably conforms
- * to the prototype suitable for use with g_hash_table_new() and a
- * fuzzy hash function isn't really appropriate for comparing hash
- * table keys since it's possible that you could end up fetching
- * different values if you end up with multiple similar keys in use
- * at the same time. If you consider that fuzzyness allows cases
- * such as A == B == C but A != C then you could also end up losing
- * values in a hash table.
- *
- * We do at least use the == operator to compare values though so
- * that -0 is considered equal to 0.
- */
+ cogl_matrix_to_graphene_matrix (a, &ma);
+ cogl_matrix_to_graphene_matrix (b, &mb);
- /* XXX: We don't compare the flags, inverse matrix or padding */
- if (a->xx == b->xx &&
- a->xy == b->xy &&
- a->xz == b->xz &&
- a->xw == b->xw &&
- a->yx == b->yx &&
- a->yy == b->yy &&
- a->yz == b->yz &&
- a->yw == b->yw &&
- a->zx == b->zx &&
- a->zy == b->zy &&
- a->zz == b->zz &&
- a->zw == b->zw &&
- a->wx == b->wx &&
- a->wy == b->wy &&
- a->wz == b->wz &&
- a->ww == b->ww)
- return TRUE;
- else
- return FALSE;
+ return graphene_matrix_equal_fast (&ma, &mb);
}
CoglMatrix *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]