diff options
author | Andrea Canciani <ranma42@gmail.com> | 2010-10-22 13:43:01 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2010-10-29 17:31:22 +0200 |
commit | d6c3451ee24555abd0e9dcb5e5b8e4f85b70b7f0 (patch) | |
tree | 60e899bb8e7a42970a14e5ac7741e55baaecdf2d /src/cairo-rectangle.c | |
parent | 46584e01a8acfb43bb4af1b4e3b89b5cb5ebe246 (diff) | |
download | cairo-d6c3451ee24555abd0e9dcb5e5b8e4f85b70b7f0.tar.gz |
box: Add _cairo_box_add_curve_to
Add a function to extend a box with the extents of a curve_to
operation.
Diffstat (limited to 'src/cairo-rectangle.c')
-rw-r--r-- | src/cairo-rectangle.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cairo-rectangle.c b/src/cairo-rectangle.c index cb82ea5c3..3a541eba4 100644 --- a/src/cairo-rectangle.c +++ b/src/cairo-rectangle.c @@ -262,3 +262,32 @@ _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line) return FALSE; } + +static cairo_status_t +_cairo_box_add_spline_point (void *closure, + const cairo_point_t *point) +{ + _cairo_box_add_point (closure, point); + + return CAIRO_STATUS_SUCCESS; +} + +/* assumes a has been previously added */ +void +_cairo_box_add_curve_to (cairo_box_t *extents, + const cairo_point_t *a, + const cairo_point_t *b, + const cairo_point_t *c, + const cairo_point_t *d) +{ + _cairo_box_add_point (extents, d); + if (!_cairo_box_contains_point (extents, b) || + !_cairo_box_contains_point (extents, c)) + { + cairo_status_t status; + + status = _cairo_spline_bound (_cairo_box_add_spline_point, + extents, a, b, c, d); + assert (status == CAIRO_STATUS_SUCCESS); + } +} |