[cairo] Re: cairo_get_current_point bug ?

Carl Worth cworth at cworth.org
Thu Sep 28 15:43:57 PDT 2006


On Thu, 28 Sep 2006 13:48:17 -0700, Bill Spitzak wrote:
> I think "the last location of the current point" and "0,0 when a new
> cairo_t is created" is pretty well defined and would work for this.

I think that that would be really hard to document. But worse, I think
it doesn't work.

>                                                                     This
> would also mean that all the code could just track the current point in
> device space and most of the if statements you have left to check if
> there is a current point could be removed.

Let's look at what happens with a current point that is locked into a
device-space origin of (0,0) when the context is created.

First, let's assume we create a path with a relative path-construction
operation as the first operation, (since these are the only operations
that care about the current point). That is, our path creation might
consists of simply:

	cairo_rel_line_to (cr, 5, 5);

Which, given an identity CTM, we all agree should result in a path
consisting of MOVE_TO (0, 0) and LINE_TO (5, 5), right?

Now, let's suppose that that path creation exists inside an
application function and that the calling function wants to transform
it, (with a simple translation, for example). That is, the final path
creation will look like:

	cairo_translate (cr, x, y);
	cairo_rel_line_to (cr, 5, 5);

With your device-space current point you end up with a path of MOVE_TO
(0, 0) and LINE_TO (x+5, y+5), right? That's nothing like a translated
version of the path.

However, my rule of making cairo_rel_line_to have an implicit move_to
(cr, 0, 0) when there's no current point means that the resulting path
is a translated version of the original, (MOVE_TO (x, y) and LINE_TO
(x+5, y+5)).

Am I missing anything?

-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/20060928/af8e33ff/attachment.pgp


More information about the cairo mailing list