michael@0: diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: @@ -2573,29 +2573,43 @@ static cairo_int_status_t michael@0: michael@0: if (style->dash && style->num_dashes) { michael@0: #define STATIC_DASH 32 michael@0: cairo_quartz_float_t sdash[STATIC_DASH]; michael@0: cairo_quartz_float_t *fdash = sdash; michael@0: unsigned int max_dashes = style->num_dashes; michael@0: unsigned int k; michael@0: michael@0: - if (style->num_dashes%2) michael@0: - max_dashes *= 2; michael@0: - if (max_dashes > STATIC_DASH) michael@0: - fdash = _cairo_malloc_ab (max_dashes, sizeof (cairo_quartz_float_t)); michael@0: - if (fdash == NULL) michael@0: - return _cairo_error (CAIRO_STATUS_NO_MEMORY); michael@0: - michael@0: - for (k = 0; k < max_dashes; k++) michael@0: - fdash[k] = (cairo_quartz_float_t) style->dash[k % style->num_dashes]; michael@0: - michael@0: - CGContextSetLineDash (surface->cgContext, style->dash_offset, fdash, max_dashes); michael@0: - if (fdash != sdash) michael@0: - free (fdash); michael@0: + bool set_line_dash = false; michael@0: + if (style->num_dashes % 2 == 0) { michael@0: + for (k = 1; k < max_dashes; k++) { michael@0: + if (style->dash[k]) { michael@0: + set_line_dash = true; michael@0: + break; michael@0: + } michael@0: + } michael@0: + } else michael@0: + set_line_dash = true; michael@0: + michael@0: + if (set_line_dash) { michael@0: + if (style->num_dashes%2) michael@0: + max_dashes *= 2; michael@0: + if (max_dashes > STATIC_DASH) michael@0: + fdash = _cairo_malloc_ab (max_dashes, sizeof (cairo_quartz_float_t)); michael@0: + if (fdash == NULL) michael@0: + return _cairo_error (CAIRO_STATUS_NO_MEMORY); michael@0: + michael@0: + for (k = 0; k < max_dashes; k++) michael@0: + fdash[k] = (cairo_quartz_float_t) style->dash[k % style->num_dashes]; michael@0: + michael@0: + CGContextSetLineDash (surface->cgContext, style->dash_offset, fdash, max_dashes); michael@0: + if (fdash != sdash) michael@0: + free (fdash); michael@0: + } else michael@0: + CGContextSetLineDash (state.context, 0, NULL, 0); michael@0: } else michael@0: CGContextSetLineDash (state.context, 0, NULL, 0); michael@0: michael@0: michael@0: _cairo_quartz_cairo_path_to_quartz_context (path, state.context); michael@0: michael@0: _cairo_quartz_cairo_matrix_to_quartz (ctm, &strokeTransform); michael@0: CGContextConcatCTM (state.context, strokeTransform);