Fix cairo_stroke_extents and cairo_in_stroke to not crash with line width of 0.0

This fixes the line-width-zero test case and the bug reported here:

	Crash in cairo_stroke_extents whe line width is 0 and line cap is ROUND
	(_cairo_pen_find_active_cw_vertex_index)
	https://bugs.freedesktop.org/show_bug.cgi?id=10231
This commit is contained in:
Carl Worth 2007-03-15 22:08:55 -07:00
parent 23caa0f43b
commit 133183d858

View file

@ -915,6 +915,11 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_traps_t traps;
if (gstate->stroke_style.line_width <= 0.0) {
*inside_ret = FALSE;
return CAIRO_STATUS_SUCCESS;
}
_cairo_gstate_user_to_backend (gstate, &x, &y);
_cairo_traps_init (&traps);
@ -1053,6 +1058,11 @@ _cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
cairo_status_t status;
cairo_traps_t traps;
if (gstate->stroke_style.line_width <= 0.0) {
*x1 = *y1 = *x2 = *y2 = 0.0;
return CAIRO_STATUS_SUCCESS;
}
_cairo_traps_init (&traps);
status = _cairo_path_fixed_stroke_to_traps (path,