mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 11:08:12 +02:00
box: Add _cairo_box_add_curve_to
Add a function to extend a box with the extents of a curve_to operation.
This commit is contained in:
parent
46584e01a8
commit
d6c3451ee2
2 changed files with 36 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,6 +262,13 @@ cairo_private void
|
|||
_cairo_box_round_to_rectangle (const cairo_box_t *box,
|
||||
cairo_rectangle_int_t *rectangle);
|
||||
|
||||
cairo_private 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_private void
|
||||
_cairo_boxes_get_extents (const cairo_box_t *boxes,
|
||||
int num_boxes,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue