From: H.G. Muller Date: Wed, 3 Oct 2012 10:28:30 +0000 (+0200) Subject: Redo grid with cairo X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=8701da4fd9968fb938ae04c91e9f59a8d64fef9f;p=xboard.git Redo grid with cairo --- 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