Faster TFTColor processing (#10814)

This commit is contained in:
Jonathan Bennett
2026-06-29 21:50:09 -05:00
committed by GitHub
parent fd8ba4fa4e
commit 21dbe21745
3 changed files with 65 additions and 7 deletions
+14
View File
@@ -792,6 +792,20 @@ void clearTFTColorRegions()
colorRegionCount = 0;
}
// Per-row culling fast path (see TFTColorRegions.h / resolveTFTColorPixelRow()).
uint8_t tftColorRowRegions[MAX_TFT_COLOR_REGIONS];
uint8_t tftColorRowCount = 0;
void beginTFTColorRow(int16_t y)
{
tftColorRowCount = 0;
for (uint8_t i = 0; i < colorRegionCount; i++) {
const TFTColorRegion &r = colorRegions[i];
if (y >= r.y && y < r.y + r.height)
tftColorRowRegions[tftColorRowCount++] = i;
}
}
uint16_t resolveTFTColorPixel(int16_t x, int16_t y, bool isset, uint16_t defaultOnColor, uint16_t defaultOffColor)
{
for (int i = static_cast<int>(colorRegionCount) - 1; i >= 0; i--) {