Skip to content

Fix zero-length stroke and dash handling - #597

Open
waywardmonkeys wants to merge 1 commit into
linebender:mainfrom
waywardmonkeys:fix/degenerate-stroke-caps
Open

Fix zero-length stroke and dash handling#597
waywardmonkeys wants to merge 1 commit into
linebender:mainfrom
waywardmonkeys:fix/degenerate-stroke-caps

Conversation

@waywardmonkeys

Copy link
Copy Markdown
Contributor

Preserve intentional zero-length geometry through dash() so stroke() can apply its cap style instead of dropping it as a degenerate segment.

Emit cap-only geometry for open and closed zero-length subpaths, including degenerate line, quadratic, and cubic commands. Butt caps remain empty, while Round, Square, and mixed caps produce the corresponding full or half shape.

Keep dash starts in the half-open range [0, path_length), avoiding spurious output at exact segment and open-path boundaries. Preserve explicit zero-length dashes as MoveTo(p)/LineTo(p) pairs, and treat zero-sum or non-finite dash inputs as undashed without relying on NaN normalization.

@waywardmonkeys
waywardmonkeys requested a review from Copilot July 23, 2026 16:46
@waywardmonkeys

Copy link
Copy Markdown
Contributor Author

I didn't mean to request a Copilot review. :(

This comment was marked as low quality.

Preserve intentional zero-length geometry through `dash()` so `stroke()`
can apply its cap style instead of dropping it as a degenerate segment.

Emit cap-only geometry for open and closed zero-length subpaths,
including degenerate line, quadratic, and cubic commands. `Butt` caps
remain empty, while `Round`, `Square`, and mixed caps produce the
corresponding full or half shape.

Keep dash starts in the half-open range `[0, path_length)`, avoiding
spurious output at exact segment and open-path boundaries. Preserve
explicit zero-length dashes as `MoveTo(p)`/`LineTo(p)` pairs, and treat
zero-sum or non-finite dash inputs as undashed without relying on `NaN`
normalization.
@waywardmonkeys
waywardmonkeys force-pushed the fix/degenerate-stroke-caps branch from bf91f7d to 1bdbca1 Compare July 23, 2026 17:09
@waywardmonkeys

Copy link
Copy Markdown
Contributor Author

Ends up Copilot was right about another edge case. Fixed it in a different way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dash iterator zero-length LineTo noise

2 participants