JPEGDEC: Fix iWidthUsed skip not advancing pixel pointer.

This commit is contained in:
Phil Howard 2023-01-13 10:38:08 +00:00 committed by Phil Howard
parent 81d9b2ab81
commit 9bd29e0ef2
1 changed files with 4 additions and 3 deletions

View File

@ -95,9 +95,10 @@ MICROPY_EVENT_POLL_HOOK
uint8_t *pixel = (uint8_t *)pDraw->pPixels;
for(int y = 0; y < pDraw->iHeight; y++) {
for(int x = 0; x < pDraw->iWidth; x++) {
if(x >= pDraw->iWidthUsed) break; // Clip to the used width
current_graphics->set_pen((uint8_t)(*pixel >> 4));
current_graphics->set_pixel({pDraw->x + x, pDraw->y + y});
if(x < pDraw->iWidthUsed) { // Clip to the used width
current_graphics->set_pen((uint8_t)(*pixel >> 4));
current_graphics->pixel({pDraw->x + x, pDraw->y + y});
}
pixel++;
}
}