From 9bd29e0ef28eae7dfbc8aba105bc3942fe2ea76b Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Fri, 13 Jan 2023 10:38:08 +0000 Subject: [PATCH] JPEGDEC: Fix iWidthUsed skip not advancing pixel pointer. --- micropython/modules/jpegdec/jpegdec.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/micropython/modules/jpegdec/jpegdec.cpp b/micropython/modules/jpegdec/jpegdec.cpp index 6153368e..fb0ba23c 100644 --- a/micropython/modules/jpegdec/jpegdec.cpp +++ b/micropython/modules/jpegdec/jpegdec.cpp @@ -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++; } }