From: H.G. Muller Date: Thu, 19 Jan 2012 11:19:27 +0000 (+0100) Subject: Fix arrow damage with highlightDragging XB X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=23912238e869ea3b134b7806456e0cfa4a363913;p=xboard.git Fix arrow damage with highlightDragging XB With highlight dragging the highlights of the previous moves are cleared when lifting the piece. Logically, this should also clear the arrow, but to do that requires a board redraw, which is not done at this stage. (And even then this would only be effective after marking the arrow damage, which is not done yet either). As a temporary fix, we repair the arrow by redrawing it. This patch has moved marking of the arrow damage from DrawArrowHighlight to a separate routine, so a future better fix can also call that when the arrow should be erased. --- diff --git a/xboard.c b/xboard.c index 559843c..f05027d 100644 --- a/xboard.c +++ b/xboard.c @@ -4213,6 +4213,8 @@ SetHighlights (int fromX, int fromY, int toX, int toY) drawHighlight(toX, toY, highlineGC); } } + if(toX<0) // clearing the highlights must have damaged arrow + DrawArrowHighlight(hi1X, hi1Y, hi2X, hi2Y); // for now, redraw it (should really be cleared!) hi1X = fromX; hi1Y = fromY; hi2X = toX; @@ -8590,11 +8592,25 @@ DrawArrowBetweenPoints (int s_x, int s_y, int d_x, int d_y) // Polygon( hdc, arrow, 7 ); } +void +ArrowDamage (int s_col, int s_row, int d_col, int d_row) +{ + int hor, vert, i; + hor = 64*s_col + 32; vert = 64*s_row + 32; + for(i=0; i<= 64; i++) { + damage[0][vert+6>>6][hor+6>>6] = True; + damage[0][vert-6>>6][hor+6>>6] = True; + damage[0][vert+6>>6][hor-6>>6] = True; + damage[0][vert-6>>6][hor-6>>6] = True; + hor += d_col - s_col; vert += d_row - s_row; + } +} + /* [AS] Draw an arrow between two squares */ void DrawArrowBetweenSquares (int s_col, int s_row, int d_col, int d_row) { - int s_x, s_y, d_x, d_y, hor, vert, i; + int s_x, s_y, d_x, d_y; if( s_col == d_col && s_row == d_row ) { return; @@ -8631,15 +8647,7 @@ DrawArrowBetweenSquares (int s_col, int s_row, int d_col, int d_row) A_WIDTH = squareSize / 14.; //[HGM] make float DrawArrowBetweenPoints( s_x, s_y, d_x, d_y ); - - hor = 64*s_col + 32; vert = 64*s_row + 32; - for(i=0; i<= 64; i++) { - damage[0][vert+6>>6][hor+6>>6] = True; - damage[0][vert-6>>6][hor+6>>6] = True; - damage[0][vert+6>>6][hor-6>>6] = True; - damage[0][vert-6>>6][hor-6>>6] = True; - hor += d_col - s_col; vert += d_row - s_row; - } + ArrowDamage(s_col, s_row, d_col, d_row); } Boolean