[cairo] Re: cairo_get_current_point bug ?

Carl Worth cworth at cworth.org
Fri Sep 22 12:49:51 PDT 2006


On Thu, 14 Sep 2006 16:59:11 -0700, "Mike Emmel" wrote:
> > Also if it would set cr->status to no current point I
> > get my path_is_empty function thats quite useful.

Yes, cairo_get_current_point really should have been written to return
the CAIRO_STATUS_NO_CURRENT_POINT value. The fact that it currently
is silently returning (0,0) without giving any indication to the user
that there is no current point is really bogus.

> -void
> +cairo_status_t
>  cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret)

Behdad just mentioned that it's too late to do this. From an API
point-of-view, there would obviously be no problem, but presumably
changing the stack like that would not allow us to provide the ABI
compatibility we've promised.

> @@ -2674,13 +2674,14 @@ cairo_get_current_point (cairo_t *cr, do
>      } else {
>  	x = _cairo_fixed_to_double (x_fixed);
>  	y = _cairo_fixed_to_double (y_fixed);
> -	_cairo_gstate_backend_to_user (cr->gstate, &x, &y);
>      }
> +	_cairo_gstate_backend_to_user (cr->gstate, &x, &y);

As for this, is there any reason that the device-space origin is more
reasonable than the user-space origin as a value for get_current_point
when there is no path? Does cairo ever treat a no-current-path
situation as equivalent to the current point being at the device-space
origin?

It seems pretty arbitrary to me either way.

So what are good options for fixing the current bug?

Do we want:

	cairo_bool_t
	cairo_has_current_point (cairo_t *cr);

Or maybe:

	cairo_bool_t
	cairo_has_path (cairo_t *cr);

Or maybe both? (They are not equivalent functions since
cairo_new_sub_path will cause there to be no current point even when
there is a non-empty path.)

Other ideas?

-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/20060922/565cf60c/attachment.pgp


More information about the cairo mailing list