Matrix effect speedup

Typically, more than 50% of pixels are black. 
This optimization avoids to fade and rewrite already black pixels.
This commit is contained in:
Frank 2023-09-18 15:56:50 +02:00 committed by GitHub
parent 555dd2e726
commit 43613e3b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5218,7 +5218,7 @@ uint16_t mode_2Dmatrix(void) { // Matrix2D. By Jeremy Williams.
if (row < rows-1) SEGMENT.setPixelColorXY(col, row+1, spawnColor);
} else {
// fade other pixels
SEGMENT.setPixelColorXY(col, row, pix.nscale8(fade));
if (pix != CRGB::Black) SEGMENT.setPixelColorXY(col, row, pix.nscale8(fade)); // optimization: don't fade black pixels
}
}
}