MCPcopy Create free account
hub / github.com/FastLED/FastLED / mapToIndex

Method mapToIndex

src/fl/math/xmap.cpp.hpp:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55u16 XMap::mapToIndex(u16 x) const {
56 u16 index;
57 switch (type) {
58 case kLinear:
59 index = x_linear(x, length);
60 break;
61 case kReverse:
62 index = x_reverse(x, length);
63 break;
64 case kFunction:
65 x = x % length;
66 index = xFunction(x, length);
67 break;
68 case kLookUpTable:
69 index = mData[x];
70 break;
71 default:
72 return 0;
73 }
74 return index + mOffset;
75}
76
77u16 XMap::getLength() const { return length; }
78

Callers 15

drawMethod · 0.45
downscaleHalfFunction · 0.45
downscaleArbitraryFunction · 0.45
upscaleArbitraryFunction · 0.45
upscalePowerOf2Function · 0.45
upscaleArbitraryFloatFunction · 0.45
upscaleFloatFunction · 0.45
sampleBilinearFunction · 0.45
sampleNearestFunction · 0.45
blur2dFunction · 0.45
blurRowsFunction · 0.45
blurColumnsFunction · 0.45

Calls 2

x_linearFunction · 0.85
x_reverseFunction · 0.85

Tested by

no test coverage detected