fix dash-zero-length test

Quartz was failing the dash-zero-length test for odd numbers
of dashes; it seems cairo wants 3 dashes to be on-off-on,
off-on-off, wheras quartz uses on-off-on, on-off-on. Fixed
by doubling the number of dashes used.
(cherry picked from commit b9c065df74)
This commit is contained in:
Brian Ewins 2007-06-24 23:53:47 +01:00 committed by Carl Worth
parent 5a3aa313d4
commit 044de7fa7a

View file

@ -1288,15 +1288,21 @@ _cairo_quartz_surface_stroke (void *abstract_surface,
#define STATIC_DASH 32
float sdash[STATIC_DASH];
float *fdash = sdash;
unsigned int max_dashes = style->num_dashes;
unsigned int k;
if (style->num_dashes > STATIC_DASH)
if (style->num_dashes%2)
max_dashes *= 2;
if (max_dashes > STATIC_DASH)
fdash = _cairo_malloc_ab (style->num_dashes, sizeof (float));
for (k = 0; k < style->num_dashes; k++)
fdash[k] = (float) style->dash[k];
CGContextSetLineDash (surface->cgContext, style->dash_offset, fdash, style->num_dashes);
if (max_dashes > STATIC_DASH)
fdash = malloc (sizeof(float)*max_dashes);
for (k = 0; k < max_dashes; k++)
fdash[k] = (float) style->dash[k % style->num_dashes];
CGContextSetLineDash (surface->cgContext, style->dash_offset, fdash, max_dashes);
if (fdash != sdash)
free (fdash);
}