X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fgfx.cc;h=226d26954369b37c945bfe69dd6494bcb0b4a1d2;hb=094e53b80e5576db6c86bb7dc6141b0cff7fa665;hp=7b3513d139897e9b3e35e80c8b65540e80451d5d;hpb=f71618aebfa6b8754dd056689a6c5821b755972c;p=winnie diff --git a/src/gfx.cc b/src/gfx.cc index 7b3513d..226d269 100644 --- a/src/gfx.cc +++ b/src/gfx.cc @@ -58,7 +58,12 @@ bool init_gfx() void destroy_gfx() { - close(dev_fd); + clear_screen(0, 0, 0); + + if(dev_fd != -1) { + close(dev_fd); + } + dev_fd = -1; munmap(framebuffer, FRAMEBUFFER_SIZE(screen_rect.width, screen_rect.height, color_depth)); @@ -87,7 +92,7 @@ void clear_screen(int r, int g, int b) void fill_rect(const Rect &rect, int r, int g, int b) { - unsigned char *fb = framebuffer + (rect.x + screen_rect.width * rect.y) * 4; + unsigned char *fb = framebuffer + (rect.x + screen_rect.width * rect.y) * 4; for(int i=0; i