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