From 8701da4fd9968fb938ae04c91e9f59a8d64fef9f Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 3 Oct 2012 12:28:30 +0200 Subject: [PATCH] Redo grid with cairo --- xboard.c | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diff --git a/xboard.c b/xboard.c index 60a5632..0fd1d3e 100644 --- a/xboard.c +++ b/xboard.c @@ -2889,12 +2889,36 @@ DrawSeekClose () } void -DrawGrid () +DrawGrid() { - XDrawSegments(xDisplay, xBoardWindow, lineGC, - gridSegments, BOARD_HEIGHT + BOARD_WIDTH + 2); -} + /* draws a grid starting around Nx, Ny squares starting at x,y */ + int i; + cairo_t *cr; + + DrawSeekOpen(); + /* get a cairo_t */ + cr = cairo_create (cs); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + cairo_set_line_width (cr, lineGap); + + /* TODO: use appdata colors */ + cairo_set_source_rgba (cr, 0, 0, 0, 1.0); + + /* lines in X */ + for (i = 0; i < BOARD_WIDTH + BOARD_HEIGHT + 2; i++) + { + cairo_move_to (cr, gridSegments[i].x1, gridSegments[i].y1); + cairo_line_to (cr, gridSegments[i].x2, gridSegments[i].y2); + cairo_stroke (cr); + } + + /* free memory */ + cairo_destroy (cr); + DrawSeekClose(); + + return; +} /* * event handler for redrawing the board -- 1.7.0.4