Skip to content

gfx: polyLineT28 drops a carry for very large edges (32*D*|B| >= 2^64) #5286

Closed

Description

@zackees

Follow-up from #5269.

Problem

polyLineT28 in src/fl/gfx/poly_abuffer.h deliberately reproduces a carry-drop from an earlier quotient loop. When 32*D*|B| >= 2^64, the computed edge coverage is wrong, which gives wrong antialiasing. Polygon coordinates are clamped to ±8191 px, so this needs edges of roughly 2900 px or more in both x and y. That is reachable through the public API.

The existing tests pin outputs produced with the carry-drop in place, so fixing it changes pinned values.

Proposed fix

  • Write a test with an edge large enough to trigger the carry-drop, compared against a wide-precision reference (for example double, or 128-bit on the host).
  • Fix the quotient loop so it propagates the carry, or does the division in a form that cannot overflow.
  • Re-pin any outputs that change, and explain each change in the PR.
  • Check that AVR code size and speed don't regress: the common, small-edge path must stay at least as fast.

Activity

  1. added
    sanitized
    on Nov 18, 2026
  2. moved this from Triage to Done in FastLED Trackeron Nov 18, 2026
  3. added a commit that references this issue on Nov 18, 2026
    1802185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions