49 mDelegate->getXYMap().setRectangularGrid();
51 void lazyInit()
override {}
54 mSurface.reset(
new CRGB[mDelegate->getNumLeds()]);
57 delegateContext.leds = mSurface.get();
58 mDelegate->draw(delegateContext);
60 uint16_t in_w = mDelegate->getWidth();
61 uint16_t in_h = mDelegate->getHeight();
62 uint16_t out_w = getWidth();
63 uint16_t out_h = getHeight();;
64 if (in_w == out_w && in_h == out_h) {
65 noExpand(mSurface.get(), context.leds, in_w, in_h);
67 expand(mSurface.get(), context.leds, in_w, in_h, mXyMap);
71 void expand(
const CRGB *input,
CRGB *output, uint16_t width,
72 uint16_t height,
XYMap mXyMap) {
73#if FASTLED_SCALE_UP == FASTLED_SCALE_UP_ALWAYS_POWER_OF_2
74 bilinearExpandPowerOf2(input, output, width, height, mXyMap);
75#elif FASTLED_SCALE_UP == FASTLED_SCALE_UP_HIGH_PRECISION
76 bilinearExpandArbitrary(input, output, width, height, mXyMap);
77#elif FASTLED_SCALE_UP == FASTLED_SCALE_UP_DECIDE_AT_RUNTIME
78 bilinearExpand(input, output, width, height, mXyMap);
79#elif FASTLED_SCALE_UP == FASTLED_SCALE_UP_FORCE_FLOATING_POINT
80 bilinearExpandFloat(input, output, width, height, mXyMap);
82#error "Invalid FASTLED_SCALE_UP"
86 const char *fxName(
int)
const override {
return "scale_up"; }
90 void noExpand(
const CRGB *input,
CRGB *output, uint16_t width,
92 uint16_t n = mXyMap.getTotal();
93 for (uint16_t w = 0; w < width; w++) {
94 for (uint16_t h = 0; h < height; h++) {
95 uint16_t idx = mXyMap.mapToIndex(w, h);
97 output[idx] = input[w * height + h];