diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-02-21 15:56:34 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-02-27 09:47:35 +0000 |
commit | 127d7f43ea7043bba1d276d9721e80a702d9fd46 (patch) | |
tree | 9c8f111b67a97ea71159cfdd3649aad2f7016f16 /src/cairo-path-bounds.c | |
parent | 65a8a279430a08e6f28b1e0354e9f18fda1a0ad7 (diff) | |
download | cairo-127d7f43ea7043bba1d276d9721e80a702d9fd46.tar.gz |
[cairo-path-bounds] _cairo_path_fixed_bounds() can fail...
I was wrong in my assertion that the call to
_cairo_path_fixed_interpret_flat() could not possibly fail with the
given _cairo_path_bounder_* callbacks - as I had missed the implicit
spline decomposition. (An interesting exercise would be to avoid the
spline allocation...) As a result we do have to check and propagate the
status return through the call stack.
Diffstat (limited to 'src/cairo-path-bounds.c')
-rw-r--r-- | src/cairo-path-bounds.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c index 581244b49..70867e31c 100644 --- a/src/cairo-path-bounds.c +++ b/src/cairo-path-bounds.c @@ -138,15 +138,14 @@ _cairo_path_bounder_close_path (void *closure) } /* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */ -void +cairo_status_t _cairo_path_fixed_bounds (cairo_path_fixed_t *path, double *x1, double *y1, double *x2, double *y2, double tolerance) { - cairo_status_t status; - cairo_path_bounder_t bounder; + cairo_status_t status; _cairo_path_bounder_init (&bounder); @@ -156,9 +155,8 @@ _cairo_path_fixed_bounds (cairo_path_fixed_t *path, _cairo_path_bounder_close_path, &bounder, tolerance); - assert (status == CAIRO_STATUS_SUCCESS); - if (bounder.has_point) { + if (status == CAIRO_STATUS_SUCCESS && bounder.has_point) { *x1 = _cairo_fixed_to_double (bounder.min_x); *y1 = _cairo_fixed_to_double (bounder.min_y); *x2 = _cairo_fixed_to_double (bounder.max_x); @@ -171,4 +169,6 @@ _cairo_path_fixed_bounds (cairo_path_fixed_t *path, } _cairo_path_bounder_fini (&bounder); + + return status; } |