From 8f628fa4e4af94adca4db9c6cc41cf016e0c3677 Mon Sep 17 00:00:00 2001 From: Eleni Maria Stea Date: Sun, 24 Feb 2013 15:49:20 +0200 Subject: [PATCH] *in progress* ouf. winnie is b-o-r-i-n-g --- src/fbdev/gfx.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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; -- 1.7.10.4