|
FastLED 3.10.10
|
|
inline |
Sort a band's active edges (idx[0..nc)) by the committed implementation's midpoint key: the FLOORED Q16.16 crossing at the band midpoint, key_e = floor((2*dy_e*x_e + B_e*mid) / (2*dy_e)), mid = a + b with a stable insertion sort (equal keys keep edge-index order).
The key is computed in i64 exactly as the committed code did, including its wrap of 2*dy*x for steep single-row edges (|2*dy*x| can exceed 2^63: |x| up to ~2^47, dy < 2^16 there) — the order that wrap produces is part of the committed output, so the wrap is reproduced bit-for-bit via unsigned arithmetic (same bits, no UB). Sorting by the exact rational x instead would change span pairing whenever two midpoints share a floored key (or the old key wrapped) and is NOT byte-identical. Cost: one i64 floor division per active edge per band (the same the committed code paid); the per-pixel kernel needs no division.
Definition at line 375 of file primitives.h.
References fl::gfx::detail::PolyEdge::B, fl::gfx::detail::PolyEdge::dy, fl::FL_NO_EXCEPT, floorDivI64(), polySortBand(), and fl::gfx::detail::PolyEdge::x.
Referenced by drawPolygonCore(), and polySortBand().
Here is the call graph for this function:
Here is the caller graph for this function: