Poor rendering of stroke-dasharray with zero-length stroke segments (dots)

Migrated from: https://bugs.launchpad.net/inkscape/+bug/1568620

Steps to reproduce:

  • open Inkscape
  • open test file
  • select paths one-by-one
svg Inkscape
dashes.svg image

What happened?

Stroke segments with 0 length are only rendered (as dots) if they the first entry in the stroke-dasharray property.

What should have happened?

Dots should also be rendered if they are at the third, fifth, ... position of the array.

Inkscape Version and Operating System:

  • Inkscape Version: 1.1-dev (12e2a09, 2020-02-19)
  • Operating System: Windows 10
  • Operating System version: 10.0.18362

Migration info

  • Not reproduced with Inkscape 0.91 and trunk rev.14557 on the same computer.
  • Reproduced with trunk rev. 14630. So it's probably due to a change between 14557 and 14630.
  • Reproduced on Xubuntu 16.04, Inkscape 0.91 and trunk rev. 14987 (cairo 1.14.6).

The dashes passed to cairo and the calculated dash count are correct:

Message: Dash 0: 5,000000
Message: Dash 1: 5,000000
Message: Ndashes: 2
Message: Dash 0: 5,000000
Message: Dash 1: 1,250000
Message: Ndashes: 2
Message: Dash 0: 2,500000
Message: Dash 1: 1,250000
Message: Dash 2: 0,000000
Message: Dash 3: 1,250000
Message: Ndashes: 4
Message: Dash 0: 2,500000
Message: Dash 1: 1,250000
Message: Dash 2: 0,000000
Message: Dash 3: 1,250000
Message: Dash 4: 0,000000
Message: Dash 5: 1,250000
Message: Ndashes: 6
Message: Dash 0: 0,000000
Message: Dash 1: 5,000000
Message: Ndashes: 2

Adding 'g_message("Dash count: %i", cairo_get_dash_count(_cr));' after the cairo_set_dash call shows that Cairo only uses a dash array of size 2 in all cases (count from comment 5 where calculated from the array passed to cairo_set_dash).

To be tested with recent Debian based OSes (with Cairo 1.14 and Inkscape 0.91). If the error is in Cairo, then the stable version should be also affected.

Edited by Nathan Lee
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information