*in progress*
authorEleni Maria Stea <elene.mst@gmail.com>
Mon, 18 Feb 2013 22:29:23 +0000 (00:29 +0200)
committerEleni Maria Stea <elene.mst@gmail.com>
Mon, 18 Feb 2013 22:29:23 +0000 (00:29 +0200)
todo: blit zz :p

src/gfx.cc
src/gfx.h

index 3de2e1d..226d269 100644 (file)
@@ -92,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<rect.height; i++) {
                for(int j=0; j<rect.width; j++) {
                        fb[j * 4] = b;
@@ -112,3 +112,18 @@ void set_cursor_visibility(bool visible)
                fprintf(stderr, "Cannot toggle cursor visibility : %s\n", strerror(errno));
        }
 }
+
+void blit(unsigned char *src_img, const Rect &src_rect, unsigned char* dest_img, int dest_x, int dest_y)
+{
+       Rect dest_rect;
+
+       if(dest_x < screen_rect.x) {
+               dest_rect.x = screen_rect.x;
+       }
+
+       if(dest_y < screen_rect.y) {
+               dest_rect.y = screen_rect.y;
+       }
+
+       //TODO :p zzz
+}
index ec31bc8..e03be2a 100644 (file)
--- a/src/gfx.h
+++ b/src/gfx.h
@@ -15,4 +15,6 @@ void fill_rect(const Rect &rect, int r, int g, int b);
 
 void set_cursor_visibility(bool visible);
 
+void blit(unsigned char *src_img, const Rect &src_rect, unsigned char* dest_img, int dest_x, int dest_y);
+
 #endif //GFX_H_