mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-03-30 11:50:37 +02:00
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:
parent
5a3aa313d4
commit
044de7fa7a
1 changed files with 11 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue