fixing a possible drawLine with x < 0 in GEQ 3D

This commit is contained in:
Frank
2024-07-17 12:44:35 +02:00
parent 40c2ef4e98
commit 13dd7f3407

View File

@@ -8464,7 +8464,7 @@ uint16_t mode_GEQLASER(void) {
if (heights[i] > 1) {
ledColorTemp = color_fade(ledColor,32,true);
int pPos = linex+(cols/NUM_BANDS)-1;
int pPos = max(0, linex+(cols/NUM_BANDS)-1);
for (int y = (i<NUM_BANDS-1) ? heights[i+1] : 0; y <= heights[i]; y++) { // don't bother drawing what we'll hide anyway
if (rows-y > 0) SEGMENT.drawLine(pPos,rows-y-1,*projector,horizon,ledColorTemp,false,depth); // right side perspective
}
@@ -8486,7 +8486,7 @@ uint16_t mode_GEQLASER(void) {
uint16_t colorIndex = map(cols/NUM_BANDS*i, 0, cols-1, 0, 255);
uint32_t ledColor = SEGMENT.color_from_palette(colorIndex, false, PALETTE_SOLID_WRAP, 0);
int linex = i*(cols/NUM_BANDS);
int pPos = linex+(cols/NUM_BANDS)-1;
int pPos = max(0, linex+(cols/NUM_BANDS)-1);
if (heights[i] > 1) {
ledColorTemp = color_fade(ledColor,32,true);