FastLED 3.9.15
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 41 of file scale_up.cpp.hpp.

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

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

+ Here is the call graph for this function: