Skip to content

Commit c491b81

Browse files
committed
one more minor optimization
1 parent 392007c commit c491b81

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

adafruit_imageload/png.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,15 @@ def load( # noqa: PLR0912, PLR0915, Too many branches, Too many statements
114114
dst = 0
115115
src = 1
116116
src_b = 1
117+
if (
118+
(implementation[1][0] == 9 and implementation[1][1] < 2) or implementation[1][0] < 9
119+
) and (depth < 8 or width % 4 != 0):
120+
workaround = True
121+
else:
122+
workaround = False
123+
117124
for y in range(height):
118-
if (
119-
(implementation[1][0] == 9 and implementation[1][1] < 2) or implementation[1][0] < 9
120-
) and (depth < 8 or width % 4 != 0):
125+
if (workaround):
121126
# Work around the bug in displayio.Bitmap
122127
# remove once CircuitPython 9.1 is no longer supported
123128
# https://github.com/adafruit/circuitpython/issues/6675

0 commit comments

Comments
 (0)