616 {
619 s16x16 dx = x1 - x0;
620 s16x16 dy = y1 - y0;
622 int steps =
fl::max(1, (max_delta * s16x16(3)).to_int());
623 s16x16 invSteps = s16x16(1) / s16x16(
steps);
624
625 i32 *__restrict__ rp =
mState.r.data();
626 i32 *__restrict__ gp =
mState.g.data();
627 i32 *__restrict__ bp =
mState.b.data();
628
629
630 s16x16 dx_step = dx * invSteps;
631 s16x16 dy_step = dy * invSteps;
632 s16x16 u = s16x16();
633 s16x16 px = x0;
634 s16x16 py = y0;
635
636 for (
int i = 0; i <=
steps; i++, u = u + invSteps, px = px + dx_step, py = py + dy_step) {
638
643 constexpr s16x16 one(1.0f);
644 s16x16 inv_fx = one - fx;
645 s16x16 inv_fy = one - fy;
646
647 i32 weights[4] = {
648 (inv_fx * inv_fy).raw(),
649 (fx * inv_fy).raw(),
650 (inv_fx * fy).raw(),
651 (fx * fy).raw(),
652 };
653
654
655 i32 cr_raw = static_cast<i32>(c.r) << 16;
656 i32 cg_raw = static_cast<i32>(c.g) << 16;
657 i32 cb_raw = static_cast<i32>(c.b) << 16;
658
659 int offX[4] = {0, 1, 0, 1};
660 int offY[4] = {0, 0, 1, 1};
661
662 for (int j = 0; j < 4; j++) {
663 int cx = ix + offX[j];
664 int cy = iy + offY[j];
665 if (cx < 0 || cx >= w || cy < 0 || cy >= h)
666 continue;
667 i32 wt_q16 = weights[j];
668 if (wt_q16 <= 0) continue;
669 int gi = cy * w + cx;
670
671 rp[gi] +=
static_cast<i32
>((
static_cast<i64>(cr_raw - rp[gi]) * wt_q16) >> 16);
672 gp[gi] +=
static_cast<i32
>((
static_cast<i64>(cg_raw - gp[gi]) * wt_q16) >> 16);
673 bp[gi] +=
static_cast<i32
>((
static_cast<i64>(cb_raw - bp[gi]) * wt_q16) >> 16);
674 }
675 }
676}
fl::UISlider colorShift("Color Shift", 0.04f, 0.0f, 0.5f, 0.01f)
constexpr FASTLED_FORCE_INLINE s16x16 floor() const FL_NOEXCEPT
constexpr i32 to_int() const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE s16x16 fract() const FL_NOEXCEPT
constexpr FASTLED_FORCE_INLINE s16x16 abs() const FL_NOEXCEPT
fl::UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT