FastLED 3.10.10
Loading...
Searching...
No Matches

◆ renderDiscRow()

template<typename PixelT, bool Overwrite>
void fl::gfx::detail::renderDiscRow ( PixelT * buf,
int w,
int py,
fl::i32 d2_row,
const DiscCtx< PixelT > & f )
inline

Render one scanline of a disc using incremental d².

Templated on Overwrite for compile-time dispatch (no per-pixel branch). Uses (n+1)² = n² + 2n + 1 identity — zero multiplies in the inner loop.

Definition at line 646 of file primitives.h.

648 {
649 PixelT* ptr = &buf[py * w + f.xmin];
650 fl::i32 d2 = d2_row;
651 fl::i32 xd = f.xdelta0;
652 int px = f.xmin;
653 // Phase 1: Skip outside pixels (left, d2 decreasing)
654 while (px <= f.xmax && d2 >= f.rout2) {
655 d2 += xd; xd += 131072; ++ptr; ++px;
656 }
657 // Phase 2: Outer AA fringe (left)
658 while (px <= f.xmax && d2 >= f.rin2 && d2 < f.rout2) {
659 fl::u16 diff = static_cast<fl::u16>(static_cast<fl::u32>(f.rout2 - d2) >> f.band_shift);
660 fl::u8 br = static_cast<fl::u8>((diff * f.band_inv) >> 8);
661 PixelT c = f.color; c.nscale8(br);
662 if (Overwrite) *ptr = c; else *ptr += c;
663 d2 += xd; xd += 131072; ++ptr; ++px;
664 }
665 // Phase 3: Full brightness interior (d2 hits minimum, then increases)
666 while (px <= f.xmax && d2 < f.rin2) {
667 if (Overwrite) *ptr = f.color; else *ptr += f.color;
668 d2 += xd; xd += 131072; ++ptr; ++px;
669 }
670 // Phase 4: Outer AA fringe (right, d2 increasing)
671 while (px <= f.xmax && d2 < f.rout2) {
672 fl::u16 diff = static_cast<fl::u16>(static_cast<fl::u32>(f.rout2 - d2) >> f.band_shift);
673 fl::u8 br = static_cast<fl::u8>((diff * f.band_inv) >> 8);
674 PixelT c = f.color; c.nscale8(br);
675 if (Overwrite) *ptr = c; else *ptr += c;
676 d2 += xd; xd += 131072; ++ptr; ++px;
677 }
678}
unsigned char u8
Definition s16x16x4.h:132
unsigned char u8
Definition stdint.h:132

References fl::FL_NO_EXCEPT, and renderDiscRow().

Referenced by drawDiscCore(), and renderDiscRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: