[cairo] Re: On recovery from errors in cairo (was: cairo reset)

Mike Emmel mike.emmel at gmail.com
Fri Sep 22 11:34:29 PDT 2006

On 9/22/06, Behdad Esfahbod <behdad at behdad.org> wrote:
> On Fri, 2006-09-22 at 14:12 -0400, Mike Emmel wrote:
> > Well so far its always been the current path problem.
> > I have a patch for cairo_get_current_point that allows the user to
> > guard agianst it.
> I'm not sure what problem you are referring to here.  The only time
> cairo goes into CAIRO_STATUS_NO_CURRENT_POINT state is if you do
> a /relative/ path operation.  ie. cairo_rel_move_to(),
> cairo_rel_line_to(), or cairo_rel_curve_to().  That's all.
> A cairo_line_to() without a current point acts like a cairo_move_to().
> And cairo_get_current_point() returns (0,0) if no point is set.  It may
> have been more useful if this also returned
> CAIRO_STATUS_NO_CURRENT_POINT instead of void, but that's not possible
> at this time.
I posted a patch for this already it has more problems then this.
In short the transorm is applied if its set and not if its not.
And I really want it to return cairo_status_t. I've got plenty of code that
does expensive set up only to do nothing if there is no path to draw.
Right now there is no way to know except a major hack.
which is to say translate and read the current point then translate back.
This is abusing the buggy impl and will tranlaste large paths.
Or get the path which causes a copy.

I can understand wanting to know if the user has never set a path and
we know that.
But why is the default state not 0 0.
I disagree that a line to results in a move to if no point is set it should
do a line to from 00 to the point its a lineto not a move to.
I feel the sematics of having the default gstate be a movto 00 are
more consistent
then what your describing. Starting with zero is well defined in most
branches of mathematics :)

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