[cairo] Re: cairo_get_current_point bug ?
Mike Emmel
mike.emmel at gmail.com
Thu Sep 14 10:44:14 PDT 2006
Also if it would set cr->status to no current point I
get my path_is_empty function thats quite useful.
Mike
On 9/14/06, Mike Emmel <mike.emmel at gmail.com> wrote:
> Here is the function
>
> void
> cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret)
> {
> cairo_status_t status;
> cairo_fixed_t x_fixed, y_fixed;
> double x, y;
>
> status = _cairo_path_fixed_get_current_point (&cr->path, &x_fixed,
> &y_fixed);
> if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
> x = 0.0;
> y = 0.0;
> } else {
> x = _cairo_fixed_to_double (x_fixed);
> y = _cairo_fixed_to_double (y_fixed);
> _cairo_gstate_backend_to_user (cr->gstate, &x, &y);
> }
>
> if (x_ret)
> *x_ret = x;
> if (y_ret)
> *y_ret = y;
> }
>
>
> The problem is that if no path is set the current transform is not
> used to transform the points
> If you say translate then add a move_to 0,0 you get different results.
>
> So I think it should be.
>
> if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
> x = 0.0;
> y = 0.0;
> _cairo_gstate_backend_to_user (cr->gstate, &x, &y);
> } else {
>
>
> The workaround is to always do a move_to(0,0) in a new cairo_t.
>
> Mike
>
More information about the cairo
mailing list