using segment buffer instead of local buffer for PS (#4776)

- using segment buffer instead of local buffer to save FX ram
- fix rendering if gamma correction is disabled
- some code cleanup
- Fix for low RAM: reduce number of particles dynamically
- updated add and scale color functions to not use references
- FPS is now more consistent and on average about 15% faster
This commit is contained in:
Damian Schneider
2025-07-22 22:26:13 +02:00
committed by GitHub
parent c30c7e1da5
commit 71301ddc57
5 changed files with 193 additions and 211 deletions

View File

@@ -645,6 +645,14 @@ uint16_t Segment::virtualLength() const {
return vLength;
}
#ifndef WLED_DISABLE_2D
// maximum length of a mapped 1D segment, used in PS for buffer allocation
uint16_t Segment::maxMappingLength() const {
uint32_t vW = virtualWidth();
uint32_t vH = virtualHeight();
return max(sqrt32_bw(vH*vH + vW*vW), (uint32_t)getPinwheelLength(vW, vH)); // use diagonal
}
#endif
// pixel is clipped if it falls outside clipping range
// if clipping start > stop the clipping range is inverted
bool IRAM_ATTR_YN Segment::isPixelClipped(int i) const {