mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 07:18:04 +02:00
[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:
parent
c2adfb4052
commit
df938a515b
1 changed files with 8 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue