Skip to content

Commit bbc35ff

Browse files
committed
Fix memory region in framebuffer
The width of the screen may be different to the virtual resolution. Use `line_length` to calculate. The same setting may not be applied on different hardware.
1 parent a846095 commit bbc35ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

backend/fbdev.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ static void _twin_fbdev_put_span(twin_coord_t left,
5656
return;
5757

5858
twin_coord_t width = right - left;
59-
off_t off = top * screen->width + left;
60-
uint32_t *dest =
61-
(uint32_t *) ((uintptr_t) tx->fb_base + (off * sizeof(*dest)));
59+
uint32_t *dest;
60+
off_t off = sizeof(*dest) * left + top * tx->fb_fix.line_length;
61+
dest = (uint32_t *) ((uintptr_t) tx->fb_base + off);
6262
memcpy(dest, pixels, width * sizeof(*dest));
6363
}
6464

0 commit comments

Comments
 (0)