[cairo] Re: cairo_get_current_point bug ?

Bill Spitzak spitzak at d2.com
Thu Sep 28 13:48:17 PDT 2006

Carl Worth wrote:
> On Fri, 22 Sep 2006 14:15:23 -0700, Bill Spitzak wrote:
>> Behdad Esfahbod wrote:
>>> Mike has a point.  We really want to keep the invariant that:
>>>   cairo_get_current_point (cr, &x0, &y0);
>>>   cairo_translate (cr, x1, y1);
>>>   cairo_get_current_point (cr, &x2, &y2);
>>>   assert (x0 == x1 + x2 && y0 == y1 + y2);
>> Whoa! Good point! I retract my previous statement that having the 0,0 be
>>   in user space is a good idea.
> I'm still not sure that I'm convinced of this.
> I forgot to mention it in the mail I just sent with the
> no-current-point patchset, but it argues for the user-space origin
> being returned from cairo_get_current_point in this case, (since an
> implicit move_to (0, 0) is really the only sensible thing to add to
> make the relative path-construction functions not yield an error).
> Meanwhile, the discussion is about what value to provide when we know
> that there is no well-defined value whatsoever. So that's silly to even
> talk about, but I would argue that it's definitely better to return a
> "nothing" value rather than something that pretends to have some
> meaning.
> -Carl

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. 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.

More information about the cairo mailing list