mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 10:18:02 +02:00
stroke: Do not initialise the pen if will not use it
The pen is only used for ensuring that we generate consist vertices around a fan used for end-capping or line-joining when set to ROUND. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
5ff689c017
commit
f7d4653c1b
1 changed files with 18 additions and 10 deletions
|
|
@ -163,6 +163,8 @@ add_fan (struct stroker *stroker,
|
|||
{
|
||||
int start, stop, step, i, npoints;
|
||||
|
||||
assert (stroker->pen.num_vertices);
|
||||
|
||||
if (clockwise) {
|
||||
step = 1;
|
||||
|
||||
|
|
@ -1357,16 +1359,21 @@ _cairo_path_fixed_stroke_to_polygon (const cairo_path_fixed_t *path,
|
|||
stroker.ctm_det_positive =
|
||||
_cairo_matrix_compute_determinant (ctm) >= 0.0;
|
||||
|
||||
status = _cairo_pen_init (&stroker.pen,
|
||||
style->line_width / 2.0,
|
||||
tolerance, ctm);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
stroker.pen.num_vertices = 0;
|
||||
if (path->has_curve_to ||
|
||||
style->line_join == CAIRO_LINE_JOIN_ROUND ||
|
||||
style->line_cap == CAIRO_LINE_CAP_ROUND) {
|
||||
status = _cairo_pen_init (&stroker.pen,
|
||||
style->line_width / 2.0,
|
||||
tolerance, ctm);
|
||||
if (unlikely (status))
|
||||
return status;
|
||||
|
||||
/* If the line width is so small that the pen is reduced to a
|
||||
single point, then we have nothing to do. */
|
||||
if (stroker.pen.num_vertices <= 1)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
/* If the line width is so small that the pen is reduced to a
|
||||
single point, then we have nothing to do. */
|
||||
if (stroker.pen.num_vertices <= 1)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
stroker.has_current_face = FALSE;
|
||||
stroker.has_first_face = FALSE;
|
||||
|
|
@ -1396,7 +1403,8 @@ _cairo_path_fixed_stroke_to_polygon (const cairo_path_fixed_t *path,
|
|||
|
||||
_cairo_contour_fini (&stroker.cw.contour);
|
||||
_cairo_contour_fini (&stroker.ccw.contour);
|
||||
_cairo_pen_fini (&stroker.pen);
|
||||
if (stroker.pen.num_vertices)
|
||||
_cairo_pen_fini (&stroker.pen);
|
||||
|
||||
#if DEBUG
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue