FastLED 3.10.6
Loading...
Searching...
No Matches

◆ constructWithLookUpTable()

XYMap fl::XYMap::constructWithLookUpTable ( u16 width,
u16 height,
const u16 * lookUpTable,
u16 offset = 0 )
static

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

44 {
46 out.mLookUpTable = fl::make_shared<LUT16>(width * height);
47 // A null table means "allocate it, I will fill it" -- which is what
48 // `fromXMap` below asks for, and it used to `memcpy` from nullptr and
49 // segfault every caller of `Channel::setScreenMap(const XMap&)`
50 // (#4201). `LUT16` zeroes its storage, so the unfilled case is an
51 // identity-free map rather than garbage.
52 if (lookUpTable != nullptr) {
53 fl::memcpy(out.mLookUpTable->getDataMutable(), lookUpTable,
54 width * height * sizeof(u16));
55 }
56 out.mOffset = offset;
57 return out;
58}
u16 width
Definition xymap.h:128
@ kLookUpTable
Definition xymap.h:43
u16 height
Definition xymap.h:129
XYMap(u16 width, u16 height, bool is_serpentine=true, u16 offset=0) FL_NO_EXCEPT
Definition xymap.cpp.hpp:88
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
void * memcpy(void *dest, const void *src, size_t n) FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:414

References XYMap(), height, kLookUpTable, fl::make_shared(), fl::memcpy(), mLookUpTable, mOffset, offset(), and width.

Referenced by fromXMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: