From 2603fb51db63ac99f8692b0b906a32841273d7b3 Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Wed, 22 Sep 2010 11:53:21 -0700 Subject: More rendering... --- draw.c | 5 +++-- draw.h | 2 +- render.c | 5 ++++- window.c | 2 +- xlib_api.c | 4 +++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/draw.c b/draw.c index 73b41cb..9d0a0ef 100644 --- a/draw.c +++ b/draw.c @@ -27,8 +27,9 @@ void draw_rectangle(GC gc, xenon_rect* r) damage_add(r); } -void draw_image(GC gc, XImage* image, xenon_rect area, int x, int y) +void draw_image(GC gc, XImage* image, xenon_rect* area, int x, int y) { - + //image->funcs.get_pixel(image,i,j); + damage_add(area); } diff --git a/draw.h b/draw.h index c7445d4..7e6a2e1 100644 --- a/draw.h +++ b/draw.h @@ -21,7 +21,7 @@ extern xenon_rect screen_rect; extern void draw_point(GC gc, int x, int y); extern void draw_rectangle(GC gc, xenon_rect* r); -extern void draw_image(GC gc, XImage* image, xenon_rect area, int x, int y); +extern void draw_image(GC gc, XImage* image, xenon_rect* area, int x, int y); #endif diff --git a/render.c b/render.c index ea88c9a..99670ad 100644 --- a/render.c +++ b/render.c @@ -101,7 +101,10 @@ void render_init(int w, int h) screen_rect.w = w; screen_rect.h = h; - pixels = (unsigned char*) calloc (1, w * h * 4); + pixels = (unsigned char*) malloc (w * h * 4); + for(int y = 0 ; y < screen_rect.h ; y++) + for(int x = 0 ; x < screen_rect.w ; x++) + pixelrgba(x,y) = 0xFF501010; render_update(screen_rect); } diff --git a/window.c b/window.c index a78be77..5774bd8 100644 --- a/window.c +++ b/window.c @@ -33,7 +33,7 @@ xenon_window* window_find(Window wid) void window_resize(Window w, int width, int height) { xenon_window* xw = window_find(w); - + } void window_move(Window w, int posx, int posy) diff --git a/xlib_api.c b/xlib_api.c index 760e80d..6d63a48 100644 --- a/xlib_api.c +++ b/xlib_api.c @@ -174,6 +174,8 @@ int XNextEvent( XEvent* event_return ) { + printf("event requested\n"); + event_return->type = KeyPress; } Display *XOpenDisplay( @@ -263,7 +265,7 @@ int XPutImage( } xenon_rect r = {src_x,src_y,width,height}; - draw_image(gc, image, r, dest_x, dest_y); + draw_image(gc, image, &r, dest_x, dest_y); printf("put image ok\n"); } -- cgit v1.2.3