X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=7de8543a3e451eceff4c9cacc8d29bd716c48512;hb=1361f4143e3f97e179c1a45294b0f72b70804f72;hp=4d1224156f54da3354b425ea239e6d3ddf90725d;hpb=7a6d7a879a119bb1050bc42fc13a83646ab0a002;p=xboard.git diff --git a/xboard.c b/xboard.c index 4d12241..7de8543 100644 --- a/xboard.c +++ b/xboard.c @@ -2534,11 +2534,17 @@ DoDrawBorder (cairo_surface_t *cs, int x, int y, int type) { cairo_t *cr; DrawSeekOpen(); + char *col; + switch(type) { + case 0: col = "#000000"; break; + case 1: col = appData.highlightSquareColor; break; + case 2: col = appData.premoveHighlightColor; break; + } 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); + SetPen(cr, lineGap, col, 0); cairo_stroke(cr); } @@ -3109,9 +3115,9 @@ void DrawSeekDot(int x, int y, int colorNr) colorNr &= 0x7F; if(square) - cairo_rectangle (cr, x-squareSize/9, y-squareSize/9, 2*squareSize/9, 2*squareSize/9); + cairo_rectangle (cr, x-squareSize/9, y-squareSize/9, 2*(squareSize/9), 2*(squareSize/9)); else - cairo_arc(cr, x, y, squareSize/8, 0.0, 2*M_PI); + cairo_arc(cr, x, y, squareSize/9, 0.0, 2*M_PI); SetPen(cr, 2, "#000000", 0); cairo_stroke_preserve(cr); @@ -4142,18 +4148,12 @@ OverlayPiece (ChessSquare piece, GC clip, GC outline, Drawable dest) static void CairoOverlayPiece (ChessSquare piece, cairo_surface_t *dest) { - static ChessSquare oldPiece = -1; - static int oldSize; static cairo_t *pieceSource; - extern int doubleClick; // in backend.c - if(piece != oldPiece || squareSize != oldSize) { // try make it faster by only changing cr if we need other piece - if(pieceSource) cairo_destroy (pieceSource); - pieceSource = cairo_create (dest); - cairo_set_source_surface (pieceSource, pngPieceBitmaps[!White(piece)][piece % BlackPawn], 0, 0); - oldPiece = piece; oldSize = squareSize; - } + pieceSource = cairo_create (dest); + cairo_set_source_surface (pieceSource, pngPieceBitmaps[!White(piece)][piece % BlackPawn], 0, 0); if(doubleClick) cairo_paint_with_alpha (pieceSource, 0.6); else cairo_paint(pieceSource); + cairo_destroy (pieceSource); } void @@ -4211,15 +4211,12 @@ SetDragPiece (AnimNr anr, ChessSquare piece) /* [AS] Arrow highlighting support */ -void DrawPolygon(Pnt arrow[], int nr) -{ // for now on own surface; eventually this should become a global that is only destroyed on resize - cairo_surface_t *boardSurface; +void +DoDrawPolygon (cairo_surface_t *cs, Pnt arrow[], int nr) +{ cairo_t *cr; int i; - int w = lineGap + BOARD_WIDTH * (squareSize + lineGap); - int h = lineGap + BOARD_HEIGHT * (squareSize + lineGap); - boardSurface = cairo_xlib_surface_create(xDisplay, xBoardWindow, DefaultVisual(xDisplay, 0), w, h); - cr = cairo_create (boardSurface); + cr = cairo_create (cs); cairo_move_to (cr, arrow[nr-1].x, arrow[nr-1].y); for (i=0;i