File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,19 @@ def load(
112112 for y in range (height ):
113113 dst = y * scanline
114114 src = y * (scanline + 1 ) + 1
115- mem [dst : dst + scanline ] = data_bytes [src : src + scanline ]
115+ if depth < 8 :
116+ # Work around the bug in displayio.Bitmap
117+ # https://github.com/adafruit/circuitpython/issues/6675
118+ pixels_per_byte = 8 // depth
119+ for x in range (0 , width , pixels_per_byte ):
120+ byte = data_bytes [src ]
121+ for pixel in range (pixels_per_byte ):
122+ bmp [x + pixel , y ] = (
123+ byte >> ((pixels_per_byte - pixel - 1 ) * depth )
124+ ) & ((1 << depth ) - 1 )
125+ src += 1
126+ else :
127+ mem [dst : dst + scanline ] = data_bytes [src : src + scanline ]
116128 return bmp , pal
117129 # RGB, RGBA or Grayscale
118130 import displayio
You can’t perform that action at this time.
0 commit comments