Simplify return value from cairo_path_fixed_get_current_point().

The only caller of cairo_path_fixed_get_current_point(), used the status
return to determine whether or not the path had a current point (and did
not propagate the error) - for which we had already removed the
_cairo_error() markup. Now we reduce the boolean status return to a
cairo_bool_t, with a net reduction in code.
This commit is contained in:
Chris Wilson 2007-10-30 10:42:22 +00:00
parent 4a2ab87e1a
commit 6fdb7f129c
3 changed files with 10 additions and 16 deletions

View file

@ -340,21 +340,18 @@ _cairo_path_fixed_close_path (cairo_path_fixed_t *path)
return CAIRO_STATUS_SUCCESS;
}
cairo_status_t
cairo_bool_t
_cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
cairo_fixed_t *x,
cairo_fixed_t *y)
{
if (! path->has_current_point) {
/* No need for _cairo_error() as the only caller,
* cairo_get_current_point(), expects and handles NO_CURRENT_POINT */
return CAIRO_STATUS_NO_CURRENT_POINT;
}
if (! path->has_current_point)
return FALSE;
*x = path->current_point.x;
*y = path->current_point.y;
return CAIRO_STATUS_SUCCESS;
return TRUE;
}
static cairo_status_t

View file

@ -3166,20 +3166,17 @@ cairo_get_antialias (cairo_t *cr)
void
cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret)
{
cairo_status_t status = CAIRO_STATUS_NO_CURRENT_POINT;
cairo_fixed_t x_fixed, y_fixed;
double x, y;
if (cr->status == CAIRO_STATUS_SUCCESS)
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 {
if (cr->status == CAIRO_STATUS_SUCCESS &&
_cairo_path_fixed_get_current_point (cr->path, &x_fixed, &y_fixed)) {
x = _cairo_fixed_to_double (x_fixed);
y = _cairo_fixed_to_double (y_fixed);
_cairo_gstate_backend_to_user (cr->gstate, &x, &y);
} else {
x = 0.0;
y = 0.0;
}
if (x_ret)

View file

@ -1479,7 +1479,7 @@ _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
cairo_private cairo_status_t
_cairo_path_fixed_close_path (cairo_path_fixed_t *path);
cairo_private cairo_status_t
cairo_private cairo_bool_t
_cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
cairo_fixed_t *x,
cairo_fixed_t *y);