pub fn dash_path(path: &BezPath, dash: DashPattern) -> BezPathExpand description
path expanded into the sub-paths dash breaks it into.
Both ends of the expansion go through well_formed. The input needs it
because kurbo::dash mishandles a subpath that closes without ever
producing a segment: it emits that subpath’s closing element ahead of the
MoveTo meant to open the output, so a path whose first subpath is a
zero-length closed one (a dashed arc at zero sweep records exactly that)
dashes to a sequence beginning with ClosePath. Such a sequence is not a
path any consumer can read — BezPath’s own “begins with MoveTo”
invariant is asserted in a debug build and silently strokes malformed
geometry in a release one. Normalizing those subpaths away first removes
the input the iterator gets wrong; normalizing the result as well makes the
well-formedness of what this returns a property of this function rather
than of the dash iterator’s internal states.
Callers inside this crate only ever reach dash here once
dash_cycle_is_normalizable has passed it, since kurbo::dash itself
does not bound its catch-up loop against a non-normalizable cycle; a caller
outside the up-front walk carries that same obligation. Made pub (rather
than pub(crate)) so frust-testing’s CPU oracle, which keeps its own
independent copy of this lowering (see that crate’s oracle_cpu module
docs for why), can pin its output against this one directly rather than
only through a rendered image.