[cairo] cairo_matrix_transform_point, only X or Y

Carl Worth cworth at cworth.org
Mon Aug 7 11:40:08 PDT 2006

On Sat, 05 Aug 2006 14:50:40 +0100, "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.

That something "seems wasteful" is a poor reason to start optimizing
code---particularly with API consequences.

> 	1- Should I prepare a patch to add cairo_matrix_transform_x and
> cairo_matrix_transform_y?

If you submitted a patch for this, I would first ask you to submit
justification for it, (for example a program that can be shown to
measurably benefit from the patch).

> 	2- Or is it pointless to optimise here?

My guess is yes. What we're talking about in transforming a coordinate
through a cairo matrix is a pair of multiplications and a pair of
additions. I just can't imagine a case where that overhead will be
significant enough to warrant special-purpose API here. (But again,
I'm guessing here---and what I'd like to like to see is less guessing
and more measurement.)

So, if you're concerned with performance, please start by profiling
your application to find out where the problems are and we can focus
on those.

-------------- 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/20060807/d3e7c4d3/attachment.pgp

More information about the cairo mailing list