Redo highlights with cairo
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 3 Oct 2012 12:27:14 +0000 (14:27 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sun, 21 Oct 2012 09:28:09 +0000 (11:28 +0200)
xboard.c

index e3afe5d..97cc06d 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -204,6 +204,7 @@ extern char *getenv();
 #include "childio.h"
 #include "xgamelist.h"
 #include "xhistory.h"
+#include "xevalgraph.h"
 #include "xedittags.h"
 #include "menus.h"
 #include "board.h"
@@ -2425,15 +2426,21 @@ do_flash_delay (unsigned long msec)
     TimeDelay(msec);
 }
 
+static cairo_surface_t *cs; // to keep out of back-end :-(
+
 void
 DrawBorder (int x, int y, int type)
 {
-    GC gc = lineGC;
+    cairo_t *cr;
+    DrawSeekOpen();
 
-    if(type == 1) gc = highlineGC; else if(type == 2) gc = prelineGC;
+    cr = cairo_create(cs);
+    cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+    cairo_rectangle(cr, x, y, squareSize+lineGap, squareSize+lineGap);
+    SetPen(cr, lineGap, type == 1 ? appData.highlightSquareColor : appData.premoveHighlightColor, 0);
+    cairo_stroke(cr);
 
-    XDrawRectangle(xDisplay, xBoardWindow, gc, x, y,
-                  squareSize+lineGap, squareSize+lineGap);
+    DrawSeekClose();
 }
 
 static int
@@ -2795,8 +2802,6 @@ EventProc (Widget widget, caddr_t unused, XEvent *event)
 
 // [HGM] seekgraph: some low-level drawing routines (by JC, mostly)
 
-static cairo_surface_t *cs; // to keep out of back-end :-(
-
 float
 Color (char *col, int n)
 {