Skip to content

Commit 42cfb2b

Browse files
committed
Identified issue with memoryview copy, only 4bit and less need workaround now
1 parent 7713689 commit 42cfb2b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_imageload/png.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ def load( # noqa: PLR0912, PLR0915, Too many branches, Too many statements
108108
bmp = bitmap(width, height, colors)
109109
mem = memoryview(bmp)
110110
for y in range(height):
111-
dst = y * scanline
111+
# Adjust for Displayio.Bitmap filler to scanline at byte boundry
112+
filladj = (y * ((4 - (width % 4)) % 4))
113+
dst = y * scanline + filladj
112114
src = y * (scanline + 1) + 1
113-
if depth < 5 or width % 4 != 0:
115+
if depth < 5:
114116
# Work around the bugs in displayio.Bitmap
115117
# The first should have been resolved by #9479
116118
# https://github.com/adafruit/circuitpython/issues/6675

0 commit comments

Comments
 (0)