[PATCH weston 6/8] simple-touch: more colors and thicker marks

Pekka Paalanen ppaalanen at gmail.com
Tue Jul 31 03:21:11 PDT 2012


Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 clients/simple-touch.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/clients/simple-touch.c b/clients/simple-touch.c
index b438ffa..3a1d940 100644
--- a/clients/simple-touch.c
+++ b/clients/simple-touch.c
@@ -109,6 +109,8 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id)
 		0xffffff00,
 		0xff0000ff,
 		0xffff00ff,
+		0xff00ff00,
+		0xff00ffff,
 	};
 
 	if (id < (int32_t) ARRAY_LENGTH(colors))
@@ -116,18 +118,28 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id)
 	else
 		c = 0xffffffff;
 
-	if (x < 1 || touch->width - 1 < x ||
-	    y < 1 || touch->height - 1 < y)
+	if (x < 2 || touch->width - 2 < x ||
+	    y < 2 || touch->height - 2 < y)
 		return;
 
-	p = (uint32_t *) touch->data + (x - 1) + (y -1 ) * touch->width;
+	p = (uint32_t *) touch->data + (x - 2) + (y - 2) * touch->width;
+	p[2] = c;
+	p += touch->width;
 	p[1] = c;
+	p[2] = c;
+	p[3] = c;
 	p += touch->width;
 	p[0] = c;
 	p[1] = c;
 	p[2] = c;
+	p[3] = c;
+	p[4] = c;
 	p += touch->width;
 	p[1] = c;
+	p[2] = c;
+	p[3] = c;
+	p += touch->width;
+	p[2] = c;
 
 	wl_surface_damage(touch->surface, 0, 0, touch->width, touch->height);
 }
-- 
1.7.8.6



More information about the wayland-devel mailing list