gfx/cairo/dasharray-zero-gap.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/dasharray-zero-gap.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
     1.5 +--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
     1.6 ++++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
     1.7 +@@ -2573,29 +2573,43 @@ static cairo_int_status_t
     1.8 + 
     1.9 +     if (style->dash && style->num_dashes) {
    1.10 + #define STATIC_DASH 32
    1.11 + 	cairo_quartz_float_t sdash[STATIC_DASH];
    1.12 + 	cairo_quartz_float_t *fdash = sdash;
    1.13 + 	unsigned int max_dashes = style->num_dashes;
    1.14 + 	unsigned int k;
    1.15 + 
    1.16 +-	if (style->num_dashes%2)
    1.17 +-	    max_dashes *= 2;
    1.18 +-	if (max_dashes > STATIC_DASH)
    1.19 +-	    fdash = _cairo_malloc_ab (max_dashes, sizeof (cairo_quartz_float_t));
    1.20 +-	if (fdash == NULL)
    1.21 +-	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    1.22 +-
    1.23 +-	for (k = 0; k < max_dashes; k++)
    1.24 +-	    fdash[k] = (cairo_quartz_float_t) style->dash[k % style->num_dashes];
    1.25 +-
    1.26 +-	CGContextSetLineDash (surface->cgContext, style->dash_offset, fdash, max_dashes);
    1.27 +-	if (fdash != sdash)
    1.28 +-	    free (fdash);
    1.29 ++	bool set_line_dash = false;
    1.30 ++	if (style->num_dashes % 2 == 0) {
    1.31 ++	    for (k = 1; k < max_dashes; k++) {
    1.32 ++		if (style->dash[k]) {
    1.33 ++		    set_line_dash = true;
    1.34 ++		    break;
    1.35 ++		}
    1.36 ++	    }
    1.37 ++	} else
    1.38 ++	    set_line_dash = true;
    1.39 ++
    1.40 ++	if (set_line_dash) {
    1.41 ++	    if (style->num_dashes%2)
    1.42 ++		max_dashes *= 2;
    1.43 ++	    if (max_dashes > STATIC_DASH)
    1.44 ++		fdash = _cairo_malloc_ab (max_dashes, sizeof (cairo_quartz_float_t));
    1.45 ++	    if (fdash == NULL)
    1.46 ++		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    1.47 ++
    1.48 ++	    for (k = 0; k < max_dashes; k++)
    1.49 ++		fdash[k] = (cairo_quartz_float_t) style->dash[k % style->num_dashes];
    1.50 ++
    1.51 ++	    CGContextSetLineDash (surface->cgContext, style->dash_offset, fdash, max_dashes);
    1.52 ++	    if (fdash != sdash)
    1.53 ++		free (fdash);
    1.54 ++	} else
    1.55 ++	    CGContextSetLineDash (state.context, 0, NULL, 0);
    1.56 +     } else
    1.57 + 	CGContextSetLineDash (state.context, 0, NULL, 0);
    1.58 + 
    1.59 + 
    1.60 +     _cairo_quartz_cairo_path_to_quartz_context (path, state.context);
    1.61 + 
    1.62 +     _cairo_quartz_cairo_matrix_to_quartz (ctm, &strokeTransform);
    1.63 +     CGContextConcatCTM (state.context, strokeTransform);

mercurial