Skip to content

Commit 12f4cdc

Browse files
committed
minor speed up when using workaround code
1 parent 1b6ebf7 commit 12f4cdc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_imageload/png.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ def load( # noqa: PLR0912, PLR0915, Too many branches, Too many statements
109109
bmp = bitmap(width, height, colors)
110110
mem = memoryview(bmp)
111111
for y in range(height):
112-
# Adjust for Displayio.Bitmap filler to scanline at 4-byte boundry
113-
filladj = y * ((4 - (scanline % 4)) % 4)
114-
dst = y * scanline + filladj
115112
src = y * (scanline + 1) + 1
116113
if (
117114
(implementation[1][0] == 9 and implementation[1][1] < 2) or implementation[1][0] < 9
@@ -129,6 +126,9 @@ def load( # noqa: PLR0912, PLR0915, Too many branches, Too many statements
129126
)
130127
src += 1
131128
else:
129+
# Adjust for Displayio.Bitmap filler to scanline at 4-byte boundry
130+
filladj = y * ((4 - (scanline % 4)) % 4)
131+
dst = y * scanline + filladj
132132
mem[dst : dst + scanline] = data_bytes[src : src + scanline]
133133
return bmp, pal
134134
# RGB, RGBA or Grayscale

0 commit comments

Comments
 (0)