third_party/cairo/src/cairo-boxes.c
void
_cairo_boxes_extents (const cairo_boxes_t *boxes,
		      cairo_box_t *box)
{
    const struct _cairo_boxes_chunk *chunk;
    cairo_box_t b;
    int i;

    if (boxes->num_boxes == 0) {
	box->p1.x = box->p1.y = box->p2.x = box->p2.y = 0;
	return;
    }

    b = boxes->chunks.base[0];
    for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
	for (i = 0; i < chunk->count; i++) {
	    if (chunk->base[i].p1.x < b.p1.x)
		b.p1.x = chunk->base[i].p1.x;

	    if (chunk->base[i].p1.y < b.p1.y)
		b.p1.y = chunk->base[i].p1.y;

	    if (chunk->base[i].p2.x > b.p2.x)
		b.p2.x = chunk->base[i].p2.x;

	    if (chunk->base[i].p2.y > b.p2.y)
		b.p2.y = chunk->base[i].p2.y;
	}
    }
    *box = b;
}
/** _cairo_boxes_extents:
 *
 * Computes the minimum bounding box of the given box set and stores
 * it in the given box.
 *
 * @param boxes      The box set whose minimum bounding is computed.
 * @param box        Return buffer for the computed result.
 */
Computes the minimum bounding box of the given box set and stores
it in the given box.

@param boxes      The box set whose minimum bounding is computed.
@param box        Return buffer for the computed result.
Computes the minimum bounding box of the given box set and stores it in the given box . @param boxes The box set whose minimum bounding is computed . @param box Return buffer for the computed result .
void
_cairo_boxes_extents (const cairo_boxes_t *boxes,
		      cairo_box_t *box)
{
    const struct _cairo_boxes_chunk *chunk;
    cairo_box_t b;
    int i;
    if (boxes->num_boxes == 0) {
	box->p1.x = box->p1.y = box->p2.x = box->p2.y = 0;
	return;
    }
    b = boxes->chunks.base[0];
    for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
	for (i = 0; i < chunk->count; i++) {
	    if (chunk->base[i].p1.x < b.p1.x)
		b.p1.x = chunk->base[i].p1.x;
	    if (chunk->base[i].p1.y < b.p1.y)
		b.p1.y = chunk->base[i].p1.y;
	    if (chunk->base[i].p2.x > b.p2.x)
		b.p2.x = chunk->base[i].p2.x;
	    if (chunk->base[i].p2.y > b.p2.y)
		b.p2.y = chunk->base[i].p2.y;
	}
    }
    *box = b;
}
void _cairo_boxes_extents ( const cairo_boxes_t * boxes , cairo_box_t * box ) { const struct _cairo_boxes_chunk * chunk ; cairo_box_t b ; int i ; if ( boxes -> num_boxes == 0 ) { box -> p1 . x = box -> p1 . y = box -> p2 . x = box -> p2 . y = 0 ; return ; } b = boxes -> chunks . base [ 0 ] ; for ( chunk = & boxes -> chunks ; chunk != NULL ; chunk = chunk -> next ) { for ( i = 0 ; i < chunk -> count ; i ++ ) { if ( chunk -> base [ i ] . p1 . x < b . p1 . x ) b . p1 . x = chunk -> base [ i ] . p1 . x ; if ( chunk -> base [ i ] . p1 . y < b . p1 . y ) b . p1 . y = chunk -> base [ i ] . p1 . y ; if ( chunk -> base [ i ] . p2 . x > b . p2 . x ) b . p2 . x = chunk -> base [ i ] . p2 . x ; if ( chunk -> base [ i ] . p2 . y > b . p2 . y ) b . p2 . y = chunk -> base [ i ] . p2 . y ; } } * box = b ; }
_cairo_boxes_extents:
 Computes the minimum bounding box of the given box set and stores
 it in the given box.
_cairo_boxes_extents : Computes the minimum bounding box of the given box set and stores it in the given box .