From d34e692f51511f1f75b07f43590f010e755e8cd1 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 28 Mar 2024 15:30:32 +0000 Subject: [PATCH] PNGdec: Don't add palette_offset twice. --- micropython/modules/pngdec/pngdec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/micropython/modules/pngdec/pngdec.cpp b/micropython/modules/pngdec/pngdec.cpp index 8aad7f05..139cacb1 100644 --- a/micropython/modules/pngdec/pngdec.cpp +++ b/micropython/modules/pngdec/pngdec.cpp @@ -217,7 +217,7 @@ mp_event_handle_nowait(); || current_graphics->pen_type == PicoGraphics::PEN_3BIT || current_graphics->pen_type == PicoGraphics::PEN_INKY7)) { if(current_palette_offset > 0) { - i += ((int16_t)(i) + current_palette_offset) & 0xff; + i = ((int16_t)(i) + current_palette_offset) & 0xff; } current_graphics->set_pen(i); } else { @@ -279,7 +279,7 @@ mp_event_handle_nowait(); // Copy raw palette indexes over if(current_mode == MODE_COPY) { if(current_palette_offset > 0) { - i += ((int16_t)(i) + current_palette_offset) & 0xff; + i = ((int16_t)(i) + current_palette_offset) & 0xff; } current_graphics->set_pen(i); current_graphics->rectangle({current_position.x, current_position.y, scale.x, scale.y});