Skip negative screen coordinates only after we read the bitmap row.

Otherwise, we don't crop properly.
This commit is contained in:
Jonas Diemer
2026-01-19 18:58:28 +01:00
parent 6d68466891
commit 0e58b0dad2
2 changed files with 5 additions and 4 deletions

View File

@@ -201,9 +201,6 @@ void GfxRenderer::drawBitmap(const Bitmap& bitmap, const int x, const int y, con
if (screenY >= getScreenHeight()) {
break;
}
if (screenY < 0) {
continue;
}
if (bitmap.readNextRow(outputRow, rowBytes) != BmpReaderError::Ok) {
Serial.printf("[%lu] [GFX] Failed to read row %d from bitmap\n", millis(), bmpY);
@@ -212,6 +209,10 @@ void GfxRenderer::drawBitmap(const Bitmap& bitmap, const int x, const int y, con
return;
}
if (screenY < 0) {
continue;
}
if (bmpY < cropPixY) {
// Skip the row if it's outside the crop area
continue;