1039 {
1040 PixelT* pixels =
canvas.pixels;
1043
1047
1048 fl::i32 rin8 = r8 - 128;
1049 fl::i32 rout8 = r8 + 128;
1050
1051 fl::i32 rin2 = rin8 * rin8;
1052 fl::i32 rout2 = rout8 * rout8;
1053 fl::i32 band = rout2 - rin2;
1054 if (band <= 0) return;
1055
1056 int ri = (rout8 >> 8) + 1;
1057 int cxi = cx8 >> 8;
1058 int cyi = cy8 >> 8;
1059
1060 int xmin = cxi - ri; if (xmin < 0) xmin = 0;
1061 int xmax = cxi + ri;
if (xmax >=
width) xmax =
width - 1;
1062 if (xmin > xmax) return;
1063 if (cyi + ri < 0 || cyi - ri >=
height)
return;
1064
1065 fl::i32 dx8 = (static_cast<fl::i32>(xmin) << 8) - cx8;
1066 fl::i32 dx2 = dx8 * dx8;
1067
1069 fc.
xdelta0 = 512 * dx8 + 65536;
1074
1075 fl::i32 cyfrac = (static_cast<fl::i32>(cyi) << 8) - cy8;
1076 fl::i32 d2c = dx2 + cyfrac * cyfrac;
1077
1078 if (cyi >= 0 && cyi <
height)
1080
1081 fl::i32 botd2 = d2c, botdelta = 512 * cyfrac + 65536;
1082 fl::i32 topd2 = d2c, topdelta = -512 * cyfrac + 65536;
1083 botd2 += botdelta; botdelta += 131072;
1084 topd2 += topdelta; topdelta += 131072;
1085
1086 for (int dy = 1; dy <= ri; ++dy) {
1087 bool cbot = (botd2 - dx2 <= rout2);
1088 bool ctop = (topd2 - dx2 <= rout2);
1089 if (!cbot && !ctop) break;
1090 int pyb = cyi + dy, pyt = cyi - dy;
1091 if (cbot && pyb >= 0 && pyb <
height)
1093 if (ctop && pyt >= 0 && pyt <
height)
1095 botd2 += botdelta; botdelta += 131072;
1096 topd2 += topdelta; topdelta += 131072;
1097 }
1098}
fl::CanvasRGB canvas(fl::span< CRGB >(leds, NUM_LEDS), WIDTH, HEIGHT)
void renderDiscRow(PixelT *buf, int w, int py, fl::i32 d2_row, const DiscCtx< PixelT > &f) FL_NO_EXCEPT
Render one scanline of a disc using incremental d².
fl::i32 toFixed8(Coord val) FL_NO_EXCEPT
Convert any Coord type to 8.8 fixed-point (fl::i32).
void computeBandShift(fl::i32 band, fl::u8 &shift_out, fl::u16 &inv_out) FL_NO_EXCEPT
Precompute right-shift and reciprocal multiplier for AA division.
Disc context: bundles per-circle constants into a struct passed by reference.