static void add_caps (struct stroker *stroker) { /* check for a degenerative sub_path */ if (stroker->has_sub_path && ! stroker->has_first_face && ! stroker->has_current_face && stroker->style.line_cap == CAIRO_LINE_CAP_ROUND) { /* pick an arbitrary slope to use */ cairo_slope_t slope = { CAIRO_FIXED_ONE, 0 }; cairo_stroke_face_t face; /* arbitrarily choose first_point */ compute_face (&stroker->first_point, &slope, stroker, &face); add_leading_cap (stroker, &face); add_trailing_cap (stroker, &face); /* ensure the circle is complete */ //_cairo_contour_add_point (&stroker->ccw.contour, //_cairo_contour_first_point (&stroker->ccw.contour)); } else { if (stroker->has_current_face) add_trailing_cap (stroker, &stroker->current_face); //_cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); //_cairo_contour_reset (&stroker->ccw.contour); if (stroker->has_first_face) { //_cairo_contour_add_point (&stroker->ccw.contour, //&stroker->first_face.cw); add_leading_cap (stroker, &stroker->first_face); //_cairo_polygon_add_contour (stroker->polygon, //&stroker->ccw.contour); //_cairo_contour_reset (&stroker->ccw.contour); } } }
static void add_caps (struct stroker *stroker) { /* check for a degenerative sub_path */ if (stroker->has_initial_sub_path && ! stroker->has_first_face && ! stroker->has_current_face && stroker->style.line_cap == CAIRO_LINE_CAP_ROUND) { /* pick an arbitrary slope to use */ cairo_slope_t slope = { CAIRO_FIXED_ONE, 0 }; cairo_stroke_face_t face; /* arbitrarily choose first_point */ compute_face (&stroker->first_point, &slope, stroker, &face); add_leading_cap (stroker, &face, &stroker->ccw); add_trailing_cap (stroker, &face, &stroker->ccw); /* ensure the circle is complete */ _cairo_contour_add_point (&stroker->ccw.contour, _cairo_contour_first_point (&stroker->ccw.contour)); _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); _cairo_contour_reset (&stroker->ccw.contour); } else { if (stroker->has_current_face) add_trailing_cap (stroker, &stroker->current_face, &stroker->ccw); #if DEBUG { FILE *file = fopen ("contours.txt", "a"); _cairo_debug_print_contour (file, &stroker->path); _cairo_debug_print_contour (file, &stroker->cw.contour); _cairo_debug_print_contour (file, &stroker->ccw.contour); fclose (file); _cairo_contour_reset (&stroker->path); } #endif _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); _cairo_contour_reset (&stroker->ccw.contour); if (stroker->has_first_face) { _cairo_contour_add_point (&stroker->ccw.contour, &stroker->first_face.cw); add_leading_cap (stroker, &stroker->first_face, &stroker->ccw); #if DEBUG { FILE *file = fopen ("contours.txt", "a"); _cairo_debug_print_contour (file, &stroker->ccw.contour); fclose (file); } #endif _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); _cairo_contour_reset (&stroker->ccw.contour); } _cairo_polygon_add_contour (stroker->polygon, &stroker->cw.contour); _cairo_contour_reset (&stroker->cw.contour); } }