FastLED 3.10.8
Loading...
Searching...
No Matches

◆ draw()

void fl::ScaleUp::draw ( DrawContext context)
overridevirtual

Render the effect by drawing delegate at low-res and scaling up.

Parameters
contextDrawing context containing the target XYMap and frame buffer

Implements fl::Fx.

Definition at line 42 of file scale_up.cpp.hpp.

42 {
43 if (mSurface.empty()) {
44 mSurface.resize(mDelegate->getNumLeds());
45 }
46 DrawContext delegateContext = context;
47 delegateContext.leds = fl::span<CRGB>(mSurface);
48 mDelegate->draw(delegateContext);
49
50 u16 in_w = mDelegate->getWidth();
51 u16 in_h = mDelegate->getHeight();
52 u16 out_w = getWidth();
53 u16 out_h = getHeight();
54 ;
55 if (in_w == out_w && in_h == out_h) {
56 noExpand(fl::span<const CRGB>(mSurface), context.leds, in_w, in_h);
57 } else {
58 expand(fl::span<const CRGB>(mSurface), context.leds, in_w, in_h, mXyMap);
59 }
60}
XYMap mXyMap
Definition fx2d.h:31
u16 getWidth() const FL_NO_EXCEPT
Definition fx2d.h:25
u16 getHeight() const FL_NO_EXCEPT
Definition fx2d.h:24
::fl::DrawContext DrawContext
Definition fx.h:21
void noExpand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height) FL_NO_EXCEPT
Direct copy without expansion (used when resolutions match)
fl::vector_psram< CRGB > mSurface
Low-resolution render buffer.
Definition scale_up.h:116
Fx2dPtr mDelegate
The wrapped effect that renders at low resolution.
Definition scale_up.h:115
void expand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height, const XYMap &mXyMap) FL_NO_EXCEPT
Expand a low-resolution buffer to high-resolution using bilinear interpolation.

References expand(), fl::FL_NO_EXCEPT, fl::Fx2d::getHeight(), fl::Fx2d::getWidth(), fl::DrawContext::leds, mDelegate, mSurface, fl::Fx2d::mXyMap, and noExpand().

+ Here is the call graph for this function: