Skip to content

Commit 0353cc1

Browse files
committed
pydisplay: Fix format in _framebuf.py.
Signed-off-by: Brad Barnett <[email protected]>
1 parent 69b13a7 commit 0353cc1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

micropython/pydisplay/graphics/graphics/_framebuf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,16 @@ def fill_rect(framebuf, x, y, width, height, color):
282282
width = framebuf.width - x
283283
if y + height > framebuf.height:
284284
height = framebuf.height - y
285+
stride = framebuf._stride
285286
rgb565_color = (color & 0xFFFF).to_bytes(2, "little")
286287
if np:
287288
rgb565_color_int = int.from_bytes(rgb565_color, "little")
288289
arr = np.frombuffer(framebuf._buffer, dtype=np.uint16)
289290
for _y in range(y, y + height):
290-
arr[_y * framebuf._stride + x : _y * framebuf._stride + x + width] = (
291-
rgb565_color_int
292-
)
291+
arr[_y * stride + x : _y * stride + x + width] = rgb565_color_int
293292
else:
294293
for _y in range(y, y + height):
295-
offset = _y * framebuf._stride
294+
offset = _y * stride
296295
for _x in range(x, x + width):
297296
index = (offset + _x) * 2
298297
framebuf.buffer[index : index + 2] = rgb565_color

0 commit comments

Comments
 (0)