[cairo] How to identify an identity transformation (was: cairo pattern/glitz patches)

Carl Worth cworth at cworth.org
Fri Feb 25 13:40:58 PST 2005


Regarding cairo-matrix-util-1.diff:

On Fri, 18 Feb 2005 16:06:39 -0500, David Reveman wrote:
> +cairo_private cairo_bool_t
>  _cairo_matrix_is_integer_translation(cairo_matrix_t *matrix, int *itx, int *ity);

I've committed the fixes to use cairo_bool_t/TRUE/FALSE.

> +cairo_bool_t
> +_cairo_matrix_is_identity (cairo_matrix_t *matrix)
> +{
> +    return (memcmp (matrix, &CAIRO_MATRIX_IDENTITY,
> +		    sizeof (cairo_matrix_t)) == 0);
>  }

This part I haven't committed. Doing memcmp on double just looks too
wrong to me. (The == tests in _cairo_matrix_is_integer_translation are
almost as bad, though that function does a better job with the
translation components of the matrix.)

Coming up with the right equality tests for the matrix values might be
a challenge, but I think it's worth doing.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050225/852d39c0/attachment.pgp


More information about the cairo mailing list