Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round join and all cap styles #414

Merged
merged 5 commits into from
Nov 22, 2023
Merged

Commits on Nov 22, 2023

  1. [flatten] Simplify Cubic representation

    Rather than using the `Cubic` struct, the flattening helpers operate on
    `CubicPts`, path index, and parallel curve offset directly.
    
    The older stroke bbox computation was removed since it's no longer used.
    armansito committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    d29a503 View commit details
    Browse the repository at this point in the history
  2. [flatten] Implement round join style

    Implemented the logic for round join and cap styles. The logic generates
    lines directly from a circular arc. The arc gets flattened in the
    curve's local coordinate space and transformed to device-space
    coordinates post-flattening (just like strokes work in `flatten_arc`).
    
    An advantage of flattening an arc directly is that the logic is very
    simple and involves way less ALU compared to `flatten_cubic`. The
    disadvantage is that the structure of join/cap style handling is now
    highly divergent.
    
    To reduce divergence, the shader could be restructured to model a (not
    perfectly circular) arc with cubic Beziers and let the control flow
    converge at a call to `flatten_cubic`.
    armansito committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    bac1799 View commit details
    Browse the repository at this point in the history
  3. [flatten] Support cap styles

    Implement butt/square/round start and end cap styles
    armansito committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    ab9dd6a View commit details
    Browse the repository at this point in the history
  4. [flatten] Fix infinite arc subdivision case

    If the segment angle falls below epsilon, return MAX_LINES instead
    of 1u for the line segment count. Total number of lines per arc is now
    capped at 1000.
    armansito committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    bae1d1a View commit details
    Browse the repository at this point in the history
  5. Add additional documentation around flatten_arc

    Clarified the function's behavior and input invariants
    armansito committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    6e6d02a View commit details
    Browse the repository at this point in the history