569 {
572 constexpr s16x16 half(0.5f);
573 constexpr s16x16 one(1.0f);
574 s16x16 rad = diam * half;
575
580
581 s16x16 rad_plus_half = rad + half;
582
583 i32 threshold_sq_raw = (rad_plus_half * rad_plus_half).raw();
584 i32 cr_raw = static_cast<i32>(cr) << 16;
585 i32 cg_raw = static_cast<i32>(cg) << 16;
586 i32 cb_raw = static_cast<i32>(cb) << 16;
587 i32 *__restrict__ rp =
mState.r.data();
588 i32 *__restrict__ gp =
mState.g.data();
589 i32 *__restrict__ bp =
mState.b.data();
590
591 for (
int y = y0;
y <= y1;
y++) {
592 s16x16 dy = s16x16(
y) + half - cy;
593 i32 dy_sq_raw = (dy * dy).raw();
594
595 if (dy_sq_raw >= threshold_sq_raw) continue;
596 int row_base =
y * w;
597 for (
int x = x0;
x <= x1;
x++) {
598 s16x16 dx = s16x16(
x) + half - cx;
599 i32 dist_sq_raw = dy_sq_raw + (dx * dx).raw();
600 if (dist_sq_raw >= threshold_sq_raw)
601 continue;
603 s16x16 cov =
s16x16::clamp(rad_plus_half - dist, s16x16(), one);
604 if (cov.raw() <= 0) continue;
605 int i = row_base +
x;
606
607 i32 cov_q16 = cov.raw();
608 rp[i] +=
static_cast<i32
>((
static_cast<i64>(cr_raw - rp[i]) * cov_q16) >> 16);
609 gp[i] +=
static_cast<i32
>((
static_cast<i64>(cg_raw - gp[i]) * cov_q16) >> 16);
610 bp[i] +=
static_cast<i32
>((
static_cast<i64>(cb_raw - bp[i]) * cov_q16) >> 16);
611 }
612 }
613}
constexpr FASTLED_FORCE_INLINE s16x16 ceil() const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE s16x16 clamp(s16x16 x, s16x16 lo, s16x16 hi) FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE s16x16 floor() const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE s16x16 sqrt() const FL_NOEXCEPT
static constexpr FASTLED_FORCE_INLINE s16x16 from_raw(i32 raw) FL_NOEXCEPT
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT