[cairo-path-bounds] _cairo_path_fixed_bounds() should never fail.

_cairo_path_fixed_bounds() should never fail so change return type
to void and update caller.
This commit is contained in:
Chris Wilson 2008-01-10 13:08:23 +00:00
parent 5fad969317
commit f4e7e7d6b4
2 changed files with 8 additions and 12 deletions

View file

@ -221,28 +221,24 @@ _cairo_analysis_surface_intersect_clip_path (void *abstract_surface,
cairo_analysis_surface_t *surface = abstract_surface; cairo_analysis_surface_t *surface = abstract_surface;
double x1, y1, x2, y2; double x1, y1, x2, y2;
cairo_rectangle_int_t extent; cairo_rectangle_int_t extent;
cairo_status_t status;
if (path == NULL) { if (path == NULL) {
surface->current_clip.x = 0; surface->current_clip.x = 0;
surface->current_clip.y = 0; surface->current_clip.y = 0;
surface->current_clip.width = surface->width; surface->current_clip.width = surface->width;
surface->current_clip.height = surface->height; surface->current_clip.height = surface->height;
status = CAIRO_STATUS_SUCCESS;
} else { } else {
status = _cairo_path_fixed_bounds (path, &x1, &y1, &x2, &y2); _cairo_path_fixed_bounds (path, &x1, &y1, &x2, &y2);
if (status)
return status;
extent.x = floor (x1); extent.x = floor (x1);
extent.y = floor (y1); extent.y = floor (y1);
extent.width = ceil (x2) - extent.x; extent.width = ceil (x2) - extent.x;
extent.height = ceil (y2) - extent.y; extent.height = ceil (y2) - extent.y;
_cairo_rectangle_intersect (&surface->current_clip, &extent); _cairo_rectangle_intersect (&surface->current_clip, &extent);
} }
return status; return CAIRO_STATUS_SUCCESS;
} }
static cairo_int_status_t static cairo_int_status_t

View file

@ -148,7 +148,7 @@ _cairo_path_bounder_close_path (void *closure)
} }
/* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */ /* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */
cairo_status_t void
_cairo_path_fixed_bounds (cairo_path_fixed_t *path, _cairo_path_fixed_bounds (cairo_path_fixed_t *path,
double *x1, double *y1, double *x1, double *y1,
double *x2, double *y2) double *x2, double *y2)
@ -165,7 +165,9 @@ _cairo_path_fixed_bounds (cairo_path_fixed_t *path,
_cairo_path_bounder_curve_to, _cairo_path_bounder_curve_to,
_cairo_path_bounder_close_path, _cairo_path_bounder_close_path,
&bounder); &bounder);
if (status || ! bounder.has_point) { assert (status == CAIRO_STATUS_SUCCESS);
if (! bounder.has_point) {
*x1 = *y1 = *x2 = *y2 = 0.; *x1 = *y1 = *x2 = *y2 = 0.;
} else { } else {
*x1 = _cairo_fixed_to_double (bounder.min_x); *x1 = _cairo_fixed_to_double (bounder.min_x);
@ -175,6 +177,4 @@ _cairo_path_fixed_bounds (cairo_path_fixed_t *path,
} }
_cairo_path_bounder_fini (&bounder); _cairo_path_bounder_fini (&bounder);
return status;
} }