[cairo-path-bounds] Check for the empty path.

Avoid returning uninitialized variables if we're asked to find the
bounds of an empty path - in which case we just return a rectangle
of zero width and height similar to the empty clip region.
This commit is contained in:
Chris Wilson 2007-12-17 21:39:25 +00:00
parent c2adfb4052
commit df938a515b

View file

@ -165,18 +165,16 @@ _cairo_path_fixed_bounds (cairo_path_fixed_t *path,
_cairo_path_bounder_curve_to,
_cairo_path_bounder_close_path,
&bounder);
if (status) {
*x1 = *y1 = *x2 = *y2 = 0.0;
_cairo_path_bounder_fini (&bounder);
return status;
if (status || ! bounder.has_point) {
*x1 = *y1 = *x2 = *y2 = 0.;
} else {
*x1 = _cairo_fixed_to_double (bounder.min_x);
*y1 = _cairo_fixed_to_double (bounder.min_y);
*x2 = _cairo_fixed_to_double (bounder.max_x);
*y2 = _cairo_fixed_to_double (bounder.max_y);
}
*x1 = _cairo_fixed_to_double (bounder.min_x);
*y1 = _cairo_fixed_to_double (bounder.min_y);
*x2 = _cairo_fixed_to_double (bounder.max_x);
*y2 = _cairo_fixed_to_double (bounder.max_y);
_cairo_path_bounder_fini (&bounder);
return CAIRO_STATUS_SUCCESS;
return status;
}