657 {
658 PixelT* pixels = canvas.
pixels;
661
665
666 fl::i32 rin8 = r8 - 128;
667 fl::i32 rout8 = r8 + 128;
668
669 fl::i32 rin2 = rin8 * rin8;
670 fl::i32 rout2 = rout8 * rout8;
671 fl::i32 band = rout2 - rin2;
672 if (band <= 0) return;
673
674 int ri = (rout8 >> 8) + 1;
675 int cxi = cx8 >> 8;
676 int cyi = cy8 >> 8;
677
678 int xmin = cxi - ri; if (xmin < 0) xmin = 0;
679 int xmax = cxi + ri;
if (xmax >=
width) xmax =
width - 1;
680 if (xmin > xmax) return;
681 if (cyi + ri < 0 || cyi - ri >=
height)
return;
682
683 fl::i32 dx8 = (static_cast<fl::i32>(xmin) << 8) - cx8;
684 fl::i32 dx2 = dx8 * dx8;
685
687 fc.
xdelta0 = 512 * dx8 + 65536;
692
693 fl::i32 cyfrac = (static_cast<fl::i32>(cyi) << 8) - cy8;
694 fl::i32 d2c = dx2 + cyfrac * cyfrac;
695
696 if (cyi >= 0 && cyi <
height)
698
699 fl::i32 botd2 = d2c, botdelta = 512 * cyfrac + 65536;
700 fl::i32 topd2 = d2c, topdelta = -512 * cyfrac + 65536;
701 botd2 += botdelta; botdelta += 131072;
702 topd2 += topdelta; topdelta += 131072;
703
704 for (int dy = 1; dy <= ri; ++dy) {
705 bool cbot = (botd2 - dx2 <= rout2);
706 bool ctop = (topd2 - dx2 <= rout2);
707 if (!cbot && !ctop) break;
708 int pyb = cyi + dy, pyt = cyi - dy;
709 if (cbot && pyb >= 0 && pyb <
height)
711 if (ctop && pyt >= 0 && pyt <
height)
713 botd2 += botdelta; botdelta += 131072;
714 topd2 += topdelta; topdelta += 131072;
715 }
716}
void renderDiscRow(PixelT *buf, int w, int py, fl::i32 d2_row, const DiscCtx< PixelT > &f)
Render one scanline of a disc using incremental d².
fl::i32 toFixed8(Coord val)
Convert any Coord type to 8.8 fixed-point (fl::i32).
void computeBandShift(fl::i32 band, fl::u8 &shift_out, fl::u16 &inv_out)
Precompute right-shift and reciprocal multiplier for AA division.
Disc context: bundles per-circle constants into a struct passed by reference.