summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Marchesin <stephane.marchesin@gmail.com>2010-04-29 18:13:02 -0700
committerStephane Marchesin <stephane.marchesin@gmail.com>2010-04-29 18:13:02 -0700
commita3147fea5e0b2da35e0ededd4f28b2253aa5d607 (patch)
tree5773e78e67bc10151e2f88db26a6f053c0a1f2cd
parent85597c7a68d92f26c673b75a88acb8bb50f38e61 (diff)
More draw work.
-rw-r--r--draw.c7
-rw-r--r--draw.h5
-rw-r--r--xenon.h4
-rw-r--r--xlib_api.c11
4 files changed, 27 insertions, 0 deletions
diff --git a/draw.c b/draw.c
index 4429798..6529771 100644
--- a/draw.c
+++ b/draw.c
@@ -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++)
diff --git a/draw.h b/draw.h
index 8a5bf32..399a76a 100644
--- a/draw.h
+++ b/draw.h
@@ -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
diff --git a/xenon.h b/xenon.h
index 5d6cc7d..0b2141f 100644
--- a/xenon.h
+++ b/xenon.h
@@ -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
diff --git a/xlib_api.c b/xlib_api.c
index d9ec15d..2174483 100644
--- a/xlib_api.c
+++ b/xlib_api.c
@@ -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,