third_party/cairo/src/cairo-pattern.c
cairo_bool_t
_cairo_mesh_pattern_coord_box (const cairo_mesh_pattern_t *mesh,
			       double                     *out_xmin,
			       double                     *out_ymin,
			       double                     *out_xmax,
			       double                     *out_ymax)
{
    const cairo_mesh_patch_t *patch;
    unsigned int num_patches, i, j, k;
    double x0, y0, x1, y1;

    assert (mesh->current_patch == NULL);

    num_patches = _cairo_array_num_elements (&mesh->patches);

    if (num_patches == 0)
	return FALSE;

    patch = _cairo_array_index_const (&mesh->patches, 0);
    x0 = x1 = patch->points[0][0].x;
    y0 = y1 = patch->points[0][0].y;

    for (i = 0; i < num_patches; i++) {
	for (j = 0; j < 4; j++) {
	    for (k = 0; k < 4; k++) {
		x0 = MIN (x0, patch[i].points[j][k].x);
		y0 = MIN (y0, patch[i].points[j][k].y);
		x1 = MAX (x1, patch[i].points[j][k].x);
		y1 = MAX (y1, patch[i].points[j][k].y);
	    }
	}
    }

    *out_xmin = x0;
    *out_ymin = y0;
    *out_xmax = x1;
    *out_ymax = y1;

    return TRUE;
}
/**
 * _cairo_mesh_pattern_coord_box:
 *
 * Convenience function to determine the range of the coordinates of
 * the points used to define the patches of the mesh.
 *
 * This is guaranteed to contain the pattern extents, but might not be
 * tight, just like a Bezier curve is always inside the convex hull of
 * the control points.
 *
 * This function cannot be used while the mesh is being constructed.
 *
 * The function returns TRUE and sets the output parameters to define
 * the coordinate range if the mesh pattern contains at least one
 * patch, otherwise it returns FALSE.
 **/
Convenience function to determine the range of the coordinates of
the points used to define the patches of the mesh.

This is guaranteed to contain the pattern extents, but might not be
tight, just like a Bezier curve is always inside the convex hull of
the control points.

This function cannot be used while the mesh is being constructed.

The function returns TRUE and sets the output parameters to define
the coordinate range if the mesh pattern contains at least one
patch, otherwise it returns FALSE.
Convenience function to determine the range of the coordinates of the points used to define the patches of the mesh . This is guaranteed to contain the pattern extents but might not be tight just like a Bezier curve is always inside the convex hull of the control points . This function cannot be used while the mesh is being constructed . The function returns TRUE and sets the output parameters to define the coordinate range if the mesh pattern contains at least one patch otherwise it returns FALSE .
cairo_bool_t
_cairo_mesh_pattern_coord_box (const cairo_mesh_pattern_t *mesh,
			       double                     *out_xmin,
			       double                     *out_ymin,
			       double                     *out_xmax,
			       double                     *out_ymax)
{
    const cairo_mesh_patch_t *patch;
    unsigned int num_patches, i, j, k;
    double x0, y0, x1, y1;
    assert (mesh->current_patch == NULL);
    num_patches = _cairo_array_num_elements (&mesh->patches);
    if (num_patches == 0)
	return FALSE;
    patch = _cairo_array_index_const (&mesh->patches, 0);
    x0 = x1 = patch->points[0][0].x;
    y0 = y1 = patch->points[0][0].y;
    for (i = 0; i < num_patches; i++) {
	for (j = 0; j < 4; j++) {
	    for (k = 0; k < 4; k++) {
		x0 = MIN (x0, patch[i].points[j][k].x);
		y0 = MIN (y0, patch[i].points[j][k].y);
		x1 = MAX (x1, patch[i].points[j][k].x);
		y1 = MAX (y1, patch[i].points[j][k].y);
	    }
	}
    }
    *out_xmin = x0;
    *out_ymin = y0;
    *out_xmax = x1;
    *out_ymax = y1;
    return TRUE;
}
cairo_bool_t _cairo_mesh_pattern_coord_box ( const cairo_mesh_pattern_t * mesh , double * out_xmin , double * out_ymin , double * out_xmax , double * out_ymax ) { const cairo_mesh_patch_t * patch ; unsigned int num_patches , i , j , k ; double x0 , y0 , x1 , y1 ; assert ( mesh -> current_patch == NULL ) ; num_patches = _cairo_array_num_elements ( & mesh -> patches ) ; if ( num_patches == 0 ) return FALSE ; patch = _cairo_array_index_const ( & mesh -> patches , 0 ) ; x0 = x1 = patch -> points [ 0 ] [ 0 ] . x ; y0 = y1 = patch -> points [ 0 ] [ 0 ] . y ; for ( i = 0 ; i < num_patches ; i ++ ) { for ( j = 0 ; j < 4 ; j ++ ) { for ( k = 0 ; k < 4 ; k ++ ) { x0 = MIN ( x0 , patch [ i ] . points [ j ] [ k ] . x ) ; y0 = MIN ( y0 , patch [ i ] . points [ j ] [ k ] . y ) ; x1 = MAX ( x1 , patch [ i ] . points [ j ] [ k ] . x ) ; y1 = MAX ( y1 , patch [ i ] . points [ j ] [ k ] . y ) ; } } } * out_xmin = x0 ; * out_ymin = y0 ; * out_xmax = x1 ; * out_ymax = y1 ; return TRUE ; }
_cairo_mesh_pattern_coord_box:
 Convenience function to determine the range of the coordinates of
 the points used to define the patches of the mesh.
_cairo_mesh_pattern_coord_box : Convenience function to determine the range of the coordinates of the points used to define the patches of the mesh .