[cairo] cairo reset

Vladimir Vukicevic vladimir at pobox.com
Tue Sep 26 16:48:07 PDT 2006

On 9/22/06, Mike Emmel <mike.emmel at gmail.com> wrote:
> Maybe for me the biggest grip is when the path is not valid.
> I think the answer is that CAIRO_STATUS_NO_CURRENT_POINT
> should not be fatal but the return value for the functions that cause it.
> Since they can always catch it and set a current point.
> Or fix the current point bug I mentioned to return this
> and the user can ensure the path is valid.
> The real world case is generally you can have a lot of different code
> adding to the
> current path without knowing what the current path is.
> I think its simpler to always have the moveto 0 0 in the base state.
> And the only place where you get a NO_CURRENT_POINT is in
> the get_current_point call if the user has never set path data.
> Then we never have this error. Note initializing the path to 0 0
> simply leads to
> problems IMHO.

moveto 0 0 actually causes problems; we tried this with <canvas>, and
it caused a whole bunch of problems.  See
https://bugzilla.mozilla.org/show_bug.cgi?id=296763#c10 -- if an
initial move_to(0,0) was added, then cairo_arc would have to change,
and that's way too much for no real benefit.

The methods that return CAIRO_STATUS_NO_CURRENT_POINT are all relative
moveto/lineto/etc. methods.  If you are calling one of those methods,
it's an error if there is no current point.  The real world use case
you suggest is bogus; if you are using relative methods without
knowing whether there is a current point, then the logic of your
program is broken.  Otherwise, there is no problem --
get_current_point by itself will just return 0,0 if there is no
current point, right?

    - Vlad

More information about the cairo mailing list