diff options
author | Stephane Marchesin <stephane.marchesin@gmail.com> | 2010-04-29 18:13:02 -0700 |
---|---|---|
committer | Stephane Marchesin <stephane.marchesin@gmail.com> | 2010-04-29 18:13:02 -0700 |
commit | a3147fea5e0b2da35e0ededd4f28b2253aa5d607 (patch) | |
tree | 5773e78e67bc10151e2f88db26a6f053c0a1f2cd | |
parent | 85597c7a68d92f26c673b75a88acb8bb50f38e61 (diff) |
More draw work.
-rw-r--r-- | draw.c | 7 | ||||
-rw-r--r-- | draw.h | 5 | ||||
-rw-r--r-- | xenon.h | 4 | ||||
-rw-r--r-- | xlib_api.c | 11 |
4 files changed, 27 insertions, 0 deletions
@@ -5,6 +5,13 @@ unsigned char* pixels; xenon_rect screen_rect; +void draw_point(GC gc, int x, int y) +{ + pixelrgba(x, y) = 0xffffffff; + xenon_rect r = { x, y, 1, 1 }; + damage_add(&r); +} + void draw_rectangle(GC gc, xenon_rect* r) { for(int i = r->x ; i < r->x + r->w ; i++) @@ -1,6 +1,8 @@ #ifndef _draw_h_ #define _draw_h_ +#include "xenon.h" + #define pixelr(x,y) pixels[(screen_rect.w * (y) + (x))*4 + 0] #define pixelg(x,y) pixels[(screen_rect.w * (y) + (x))*4 + 1] #define pixelb(x,y) pixels[(screen_rect.w * (y) + (x))*4 + 2] @@ -17,5 +19,8 @@ xenon_rect; extern unsigned char* pixels; extern xenon_rect screen_rect; +extern void draw_point(GC gc, int x, int y); +extern void draw_rectangle(GC gc, xenon_rect* r); + #endif @@ -1,3 +1,6 @@ +#ifndef _xenon_h_ +#define _xenon_h_ + #define XLIB_ILLEGAL_ACCESS #include <X11/Xlib.h> #include <string.h> @@ -7,3 +10,4 @@ #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) +#endif @@ -89,6 +89,17 @@ int XDrawLine( { } +int XDrawPoint( + Display* display, + Drawable d, + GC gc, + int x, + int y +) +{ + draw_point(gc, x, y); +} + int XDrawRectangle( Display* display, Drawable d, |