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

◆ renderRingRow()

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

Render one scanline of a ring using incremental d² with phase-based scanning.

Templated on Overwrite for compile-time dispatch (no per-pixel branch). Zones (left to right): outside → outer-AA → solid → inner-AA → hole → inner-AA → solid → outer-AA → outside.

Definition at line 685 of file primitives.h.

687 {
688 PixelT* ptr = &buf[py * w + g.xmin];
689 fl::i32 d2 = d2_row;
690 fl::i32 xd = g.xdelta0;
691 int px = g.xmin;
692 // Preamble: left exterior (d2 >= oo2)
693 while (px <= g.xmax && d2 >= g.oo2) {
694 d2 += xd; xd += 131072; ++ptr; ++px;
695 }
696 // Phase 1: outer-left AA fringe (oi2 <= d2 < oo2)
697 while (px <= g.xmax && d2 >= g.oi2 && d2 < g.oo2) {
698 fl::u16 diff = static_cast<fl::u16>(static_cast<fl::u32>(g.oo2 - d2) >> g.outer_shift);
699 fl::u8 br = static_cast<fl::u8>((diff * g.outer_inv) >> 8);
700 PixelT c = g.color; c.nscale8(br);
701 if (Overwrite) *ptr = c; else *ptr += c;
702 d2 += xd; xd += 131072; ++ptr; ++px;
703 }
704 // Phase 2: full-brightness band left (io2 <= d2 < oi2)
705 while (px <= g.xmax && d2 >= g.io2 && d2 < g.oi2) {
706 if (Overwrite) *ptr = g.color; else *ptr += g.color;
707 d2 += xd; xd += 131072; ++ptr; ++px;
708 }
709 // Phase 3: inner-left AA fringe (ii2 <= d2 < io2)
710 while (px <= g.xmax && d2 >= g.ii2 && d2 < g.io2) {
711 fl::u16 diff = static_cast<fl::u16>(static_cast<fl::u32>(d2 - g.ii2) >> g.inner_shift);
712 fl::u8 br = static_cast<fl::u8>((diff * g.inner_inv) >> 8);
713 PixelT c = g.color; c.nscale8(br);
714 if (Overwrite) *ptr = c; else *ptr += c;
715 d2 += xd; xd += 131072; ++ptr; ++px;
716 }
717 // Phase 4: transparent hole (d2 < ii2)
718 while (px <= g.xmax && d2 < g.ii2) {
719 d2 += xd; xd += 131072; ++ptr; ++px;
720 }
721 // Phase 5: inner-right AA fringe (ii2 <= d2 < io2)
722 while (px <= g.xmax && d2 >= g.ii2 && d2 < g.io2) {
723 fl::u16 diff = static_cast<fl::u16>(static_cast<fl::u32>(d2 - g.ii2) >> g.inner_shift);
724 fl::u8 br = static_cast<fl::u8>((diff * g.inner_inv) >> 8);
725 PixelT c = g.color; c.nscale8(br);
726 if (Overwrite) *ptr = c; else *ptr += c;
727 d2 += xd; xd += 131072; ++ptr; ++px;
728 }
729 // Phase 6: full-brightness band right (io2 <= d2 < oi2)
730 while (px <= g.xmax && d2 >= g.io2 && d2 < g.oi2) {
731 if (Overwrite) *ptr = g.color; else *ptr += g.color;
732 d2 += xd; xd += 131072; ++ptr; ++px;
733 }
734 // Phase 7: outer-right AA fringe (oi2 <= d2 < oo2)
735 while (px <= g.xmax && d2 >= g.oi2 && d2 < g.oo2) {
736 fl::u16 diff = static_cast<fl::u16>(static_cast<fl::u32>(g.oo2 - d2) >> g.outer_shift);
737 fl::u8 br = static_cast<fl::u8>((diff * g.outer_inv) >> 8);
738 PixelT c = g.color; c.nscale8(br);
739 if (Overwrite) *ptr = c; else *ptr += c;
740 d2 += xd; xd += 131072; ++ptr; ++px;
741 }
742}
unsigned char u8
Definition s16x16x4.h:132
unsigned char u8
Definition stdint.h:132
InputGamut g
Definition rgbw.h:125

References fl::FL_NO_EXCEPT, fl::g, and renderRingRow().

Referenced by drawRingCore(), and renderRingRow().

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