From: Eleni Maria Stea Date: Sun, 24 Feb 2013 13:49:20 +0000 (+0200) Subject: *in progress* X-Git-Url: http://git.mutantstargoat.com?p=winnie;a=commitdiff_plain;h=8f628fa4e4af94adca4db9c6cc41cf016e0c3677 *in progress* ouf. winnie is b-o-r-i-n-g --- diff --git a/src/fbdev/gfx.cc b/src/fbdev/gfx.cc index 00e1881..c207b0c 100644 --- a/src/fbdev/gfx.cc +++ b/src/fbdev/gfx.cc @@ -95,12 +95,20 @@ void fill_rect(const Rect &rect, int r, int g, int b) { Rect drect = rect; - if(drect.x < 0) { - drect.x = 0; + if(drect.x < screen_rect.x) { + drect.x = screen_rect.x; } - if(drect.y < 0) { - drect.y = 0; + if(drect.y < screen_rect.y) { + drect.y = screen_rect.y; + } + + if(drect.x + drect.width > screen_rect.width) { + drect.width = screen_rect.width - drect.x; + } + + if(drect.y + drect.height > screen_rect.height) { + drect.height = screen_rect.height - drect.y; } unsigned char *fb = framebuffer + (drect.x + screen_rect.width * drect.y) * 4;