/* Computes the minimum bounding box of the given list of boxes and assign it to the given boxes set. It also assigns that list as the list of limiting boxes in the box set. */
void _cairo_boxes_limit(cairo_boxes_t *boxes, const cairo_box_t *limits, int num_limits)
/* Computes the minimum bounding box of the given list of boxes and assign it to the given boxes set. It also assigns that list as the list of limiting boxes in the box set. */
void _cairo_boxes_limit(cairo_boxes_t *boxes, const cairo_box_t *limits, int num_limits)
{
    int n;
    boxes->limits = limits;
    boxes->num_limits = num_limits;
    if (boxes->num_limits) {
	boxes->limit = limits[0];
	for (n = 1; n < num_limits; n++) {
	    if (limits[n].p1.x < boxes->limit.p1.x)
		boxes->limit.p1.x = limits[n].p1.x;
	    if (limits[n].p1.y < boxes->limit.p1.y)
		boxes->limit.p1.y = limits[n].p1.y;
	    if (limits[n].p2.x > boxes->limit.p2.x)
		boxes->limit.p2.x = limits[n].p2.x;
	    if (limits[n].p2.y > boxes->limit.p2.y)
		boxes->limit.p2.y = limits[n].p2.y;
	}
    }
}