mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
cogl/matrix: Use Graphene to compare matrices
This commit is contained in:
parent
10dd3399ca
commit
3e02a89c2a
@ -1918,44 +1918,15 @@ cogl_matrix_equal (const void *v1, const void *v2)
|
||||
{
|
||||
const CoglMatrix *a = v1;
|
||||
const CoglMatrix *b = v2;
|
||||
graphene_matrix_t ga, gb;
|
||||
|
||||
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
|
||||
_COGL_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 noteably 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 loosing
|
||||
* 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, &ga);
|
||||
cogl_matrix_to_graphene_matrix (b, &gb);
|
||||
|
||||
/* 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 cogl_graphene_matrix_equal (&ga, &gb);
|
||||
}
|
||||
|
||||
CoglMatrix *
|
||||
|
Loading…
Reference in New Issue
Block a user