[cairo] cairo_matrix_transform_point, only X or Y

Bill Spitzak spitzak at d2.com
Tue Aug 8 17:25:15 PDT 2006

If Cairo is doing rotations, the output x depends on both the x and y.

I have found it very useful to have a transformed_x(x,y) call that 
actually returns the value. This makes it much easier to write code 
because you don't need to define temporary variables to pass as 
references, ie "foo(transformed_x(x,y),transformed_y(x,y))" rather than 
"double tx,ty; transform(x,y,&tx,&ty); foo(tx,ty)". However Cairo 
functions always returns an error status (right?) so such an api would 
not fit in.

Gustavo J. A. M. Carneiro wrote:
>   I found myself in a postion where I'd like to convert some code to
> transform coordinate systems over to use the cairo matrices APIs.  I
> would like to use cairo_matrix_transform_point; however, in many places
> I only need to convert either X or Y, not both, and it seems wasteful to
> transform a dummy coordinate to throw it away.
>   My question requires some knowledge of CPU performance in this case
> and I seek advice:
> 	1- Should I prepare a patch to add cairo_matrix_transform_x and
> cairo_matrix_transform_y?
> 	2- Or is it pointless to optimise here?
>   Any thoughts?
>   Regards,

More information about the cairo mailing list