summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-04-19 11:04:26 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-04-19 15:19:34 +1000
commit7da1e5fe9cdfdfa94c99818d94b8cafa391e5459 (patch)
treefae2951ef1d4ae1108a380ec5d340e29b217a51a /tools
parent9ebcc4534539575e0ea85dca2abc066e2843f1f1 (diff)
tools: draw some grids for positioning testing in the event-gui
Having a grid makes it easier to detect pointer jumps Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/event-gui.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/event-gui.c b/tools/event-gui.c
index 791a1ea..605f00a 100644
--- a/tools/event-gui.c
+++ b/tools/event-gui.c
@@ -315,6 +315,46 @@ draw_pointer(struct window *w, cairo_t *cr)
cairo_restore(cr);
}
+static inline void
+draw_background(struct window *w, cairo_t *cr)
+{
+ int x1, x2, y1, y2, x3, y3, x4, y4;
+ int cols;
+
+ /* 10px and 5px grids */
+ cairo_save(cr);
+ cairo_set_source_rgb(cr, 0.8, 0.8, 0.8);
+ x1 = w->width/2 - 200;
+ y1 = w->height/2 - 200;
+ x2 = w->width/2 + 200;
+ y2 = w->height/2 - 200;
+ for (cols = 1; cols < 10; cols++) {
+ cairo_move_to(cr, x1 + 10 * cols, y1);
+ cairo_rel_line_to(cr, 0, 100);
+ cairo_move_to(cr, x1, y1 + 10 * cols);
+ cairo_rel_line_to(cr, 100, 0);
+
+ cairo_move_to(cr, x2 + 5 * cols, y2);
+ cairo_rel_line_to(cr, 0, 50);
+ cairo_move_to(cr, x2, y2 + 5 * cols);
+ cairo_rel_line_to(cr, 50, 0);
+ }
+
+ /* 3px horiz/vert bar codes */
+ x3 = w->width/2 - 200;
+ y3 = w->height/2 + 200;
+ x4 = w->width/2 + 200;
+ y4 = w->height/2 + 100;
+ for (cols = 0; cols < 50; cols++) {
+ cairo_move_to(cr, x3 + 3 * cols, y3);
+ cairo_rel_line_to(cr, 0, 20);
+
+ cairo_move_to(cr, x4, y4 + 3 * cols);
+ cairo_rel_line_to(cr, 20, 0);
+ }
+ cairo_stroke(cr);
+}
+
static gboolean
draw(GtkWidget *widget, cairo_t *cr, gpointer data)
{
@@ -324,6 +364,8 @@ draw(GtkWidget *widget, cairo_t *cr, gpointer data)
cairo_rectangle(cr, 0, 0, w->width, w->height);
cairo_fill(cr);
+ draw_background(w, cr);
+
draw_gestures(w, cr);
draw_scrollbars(w, cr);
draw_touchpoints(w, cr);