third_party/cairo/src/cairo-stroke-style.c
void
_cairo_stroke_style_max_distance_from_path (const cairo_stroke_style_t *style,
					    const cairo_path_fixed_t *path,
                                            const cairo_matrix_t *ctm,
                                            double *dx, double *dy)
{
    double style_expansion = 0.5;

    if (style->line_cap == CAIRO_LINE_CAP_SQUARE)
	style_expansion = M_SQRT1_2;

    if (style->line_join == CAIRO_LINE_JOIN_MITER &&
	! path->stroke_is_rectilinear &&
	style_expansion < M_SQRT2 * style->miter_limit)
    {
	style_expansion = M_SQRT2 * style->miter_limit;
    }

    style_expansion *= style->line_width;

    if (_cairo_matrix_has_unity_scale (ctm)) {
	*dx = *dy = style_expansion;
    } else {
	*dx = style_expansion * hypot (ctm->xx, ctm->xy);
	*dy = style_expansion * hypot (ctm->yy, ctm->yx);
    }
}
/*
 * For a stroke in the given style, compute the maximum distance
 * from the path that vertices could be generated.  In the case
 * of rotation in the ctm, the distance will not be exact.
 */
For a stroke in the given style, compute the maximum distance
from the path that vertices could be generated.  In the case
of rotation in the ctm, the distance will not be exact.
For a stroke in the given style compute the maximum distance from the path that vertices could be generated . In the case of rotation in the ctm the distance will not be exact .
void
_cairo_stroke_style_max_distance_from_path (const cairo_stroke_style_t *style,
					    const cairo_path_fixed_t *path,
                                            const cairo_matrix_t *ctm,
                                            double *dx, double *dy)
{
    double style_expansion = 0.5;
    if (style->line_cap == CAIRO_LINE_CAP_SQUARE)
	style_expansion = M_SQRT1_2;
    if (style->line_join == CAIRO_LINE_JOIN_MITER &&
	! path->stroke_is_rectilinear &&
	style_expansion < M_SQRT2 * style->miter_limit)
    {
	style_expansion = M_SQRT2 * style->miter_limit;
    }
    style_expansion *= style->line_width;
    if (_cairo_matrix_has_unity_scale (ctm)) {
	*dx = *dy = style_expansion;
    } else {
	*dx = style_expansion * hypot (ctm->xx, ctm->xy);
	*dy = style_expansion * hypot (ctm->yy, ctm->yx);
    }
}
void _cairo_stroke_style_max_distance_from_path ( const cairo_stroke_style_t * style , const cairo_path_fixed_t * path , const cairo_matrix_t * ctm , double * dx , double * dy ) { double style_expansion = 0.5 ; if ( style -> line_cap == CAIRO_LINE_CAP_SQUARE ) style_expansion = M_SQRT1_2 ; if ( style -> line_join == CAIRO_LINE_JOIN_MITER && ! path -> stroke_is_rectilinear && style_expansion < M_SQRT2 * style -> miter_limit ) { style_expansion = M_SQRT2 * style -> miter_limit ; } style_expansion *= style -> line_width ; if ( _cairo_matrix_has_unity_scale ( ctm ) ) { * dx = * dy = style_expansion ; } else { * dx = style_expansion * hypot ( ctm -> xx , ctm -> xy ) ; * dy = style_expansion * hypot ( ctm -> yy , ctm -> yx ) ; } }
For a stroke in the given style, compute the maximum distance
 from the path that vertices could be generated.
For a stroke in the given style compute the maximum distance from the path that vertices could be generated .