*work in progress*
[winnie] / src / gfx.cc
index 0afa479..87b5939 100644 (file)
@@ -58,6 +58,7 @@ bool init_gfx()
 
 void destroy_gfx()
 {
+       clear_screen(0, 0, 0);
        close(dev_fd);
        dev_fd = -1;
 
@@ -87,12 +88,12 @@ 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; 
+       unsigned char *fb = framebuffer + (rect.x + screen_rect.width * rect.y) * 4; 
        for(int i=0; i<rect.height; i++) {
                for(int j=0; j<rect.width; j++) {
-                       fb[j * 4] = r;
+                       fb[j * 4] = b;
                        fb[j * 4 + 1] = g;
-                       fb[j * 4 + 2] = b;
+                       fb[j * 4 + 2] = r;
                }
                fb += screen_rect.width * 4;
        }