[cairo] cairo_matrix_transform_point, only X or Y

Behdad Esfahbod behdad at behdad.org
Mon Aug 7 14:00:35 PDT 2006


On Sat, 2006-08-05 at 09:50 -0400, 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?

I like your request.  Just make the current transform_* accept NULL.
(at some point we may want to start using LIKELY and UNLIKELY in cairo,
but that shouldn't really matter, compared to the floating-point
multiplication and the function call overheads.)

behdad

>   Any thoughts?
> 
>   Regards,
> 
-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"



More information about the cairo mailing list