Don't try to put pixel off-screen

This commit is contained in:
Jarkko Toivanen 2023-06-18 07:49:43 +03:00
parent fadccef0df
commit 086eba4ea4
Signed by: jt
GPG key ID: 9151B109B73ECAD5

View file

@ -19,5 +19,6 @@ void initfb(unsigned long addr, unsigned short w, unsigned short h, unsigned cha
} }
void putpixel(unsigned short x, unsigned short y, unsigned char r, unsigned char g, unsigned char b, unsigned char a) { void putpixel(unsigned short x, unsigned short y, unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
if (x>fb_width || y> fb_height) return;
*((unsigned long *)(fb_address + y*fb_pitch + x*fb_bytespp)) = r<<fb_rpos | g<<fb_gpos | b<<fb_bpos; *((unsigned long *)(fb_address + y*fb_pitch + x*fb_bytespp)) = r<<fb_rpos | g<<fb_gpos | b<<fb_bpos;
} }