mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
fix scrolling and invalidation for flipped boards, and especially
where the board is still not fully visible when the tray is hidden.
This commit is contained in:
parent
90dfc15ae9
commit
b8d3d477a5
1 changed files with 21 additions and 21 deletions
|
@ -895,23 +895,19 @@ invalCellsWithTiles( BoardCtxt* board, XP_Bool doMirror )
|
||||||
XP_Bool includePending = board->trayVisState == TRAY_REVEALED;
|
XP_Bool includePending = board->trayVisState == TRAY_REVEALED;
|
||||||
XP_S16 col, row;
|
XP_S16 col, row;
|
||||||
|
|
||||||
/* for each col,row pair, invalidate it if it holds a tile that's visible
|
/* For each col,row pair, invalidate it if it holds a tile. Previously we
|
||||||
AND if the rect itself is visible */
|
* optimized by checking that the tile was actually visible, but with
|
||||||
|
* flipping and now boards obscured by more than just the tray that's hard
|
||||||
|
* to get right. The cell drawing code is pretty good about exiting
|
||||||
|
* quickly when its cell is off the visible board. We'll count on that
|
||||||
|
* for now.
|
||||||
|
*/
|
||||||
for ( row = model_numRows( model )-1; row >= 0; --row ) {
|
for ( row = model_numRows( model )-1; row >= 0; --row ) {
|
||||||
for ( col = model_numCols( model )-1; col >= 0; --col ) {
|
for ( col = model_numCols( model )-1; col >= 0; --col ) {
|
||||||
Tile tile;
|
Tile tile;
|
||||||
XP_Bool ignore;
|
XP_Bool ignore;
|
||||||
if ( model_getTile( model, col, row, includePending,
|
if ( model_getTile( model, col, row, includePending,
|
||||||
turn, &tile, &ignore, &ignore, &ignore ) ) {
|
turn, &tile, &ignore, &ignore, &ignore ) ) {
|
||||||
|
|
||||||
if ( board->boardObscuresTray ) {
|
|
||||||
XP_Rect cellR;
|
|
||||||
if ( !getCellRect( board, col, row, &cellR )
|
|
||||||
|| (board->trayVisState != TRAY_HIDDEN &&
|
|
||||||
rectContainsRect( &board->trayBounds, &cellR )) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
invalCell( board, col, row, doMirror );
|
invalCell( board, col, row, doMirror );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1041,7 @@ board_draw( BoardCtxt* board )
|
||||||
|
|
||||||
XP_Bool allDrawn = XP_TRUE;
|
XP_Bool allDrawn = XP_TRUE;
|
||||||
XP_S16 lastCol, i;
|
XP_S16 lastCol, i;
|
||||||
XP_U16 row;
|
XP_S16 row;
|
||||||
ModelCtxt* model = board->model;
|
ModelCtxt* model = board->model;
|
||||||
BlankQueue bq;
|
BlankQueue bq;
|
||||||
|
|
||||||
|
@ -1056,7 +1052,10 @@ board_draw( BoardCtxt* board )
|
||||||
board->trayVisState == TRAY_REVEALED, &bq );
|
board->trayVisState == TRAY_REVEALED, &bq );
|
||||||
invalBlanksWithNeighbors( board, &bq );
|
invalBlanksWithNeighbors( board, &bq );
|
||||||
|
|
||||||
for ( row = board->yOffset; row < board->lastVisibleRow; ++row ) {
|
/* Don't try to optimize this using lastVisibleRow etc. If the
|
||||||
|
board is flipped, "lastVisibleRow" here is really col.
|
||||||
|
redrawFlags is at the model level, pre-flip. */
|
||||||
|
for ( row = model_numRows(model) - 1; row >= 0; --row ) {
|
||||||
XP_U16 rowFlags = board->redrawFlags[row];
|
XP_U16 rowFlags = board->redrawFlags[row];
|
||||||
if ( rowFlags != 0 ) {
|
if ( rowFlags != 0 ) {
|
||||||
XP_U16 colMask;
|
XP_U16 colMask;
|
||||||
|
@ -1678,17 +1677,18 @@ drawCell( BoardCtxt* board, XP_U16 col, XP_U16 row, XP_Bool skipBlanks )
|
||||||
XWBonusType bonus;
|
XWBonusType bonus;
|
||||||
ModelCtxt* model = board->model;
|
ModelCtxt* model = board->model;
|
||||||
DictionaryCtxt* dict = model_getDictionary( model );
|
DictionaryCtxt* dict = model_getDictionary( model );
|
||||||
XP_U16 selPlayer = board->selPlayer;
|
|
||||||
|
if ( dict != NULL && getCellRect( board, col, row, &cellRect ) ) {
|
||||||
|
|
||||||
/* We want to invert EITHER the current pending tiles OR the most recent
|
/* We want to invert EITHER the current pending tiles OR the most recent
|
||||||
* move. So if the tray is visible AND there are tiles missing from it,
|
* move. So if the tray is visible AND there are tiles missing from it,
|
||||||
* show them. Otherwise show the most recent move.
|
* show them. Otherwise show the most recent move.
|
||||||
*/
|
*/
|
||||||
|
XP_U16 selPlayer = board->selPlayer;
|
||||||
XP_U16 curCount = model_getCurrentMoveCount( model, selPlayer );
|
XP_U16 curCount = model_getCurrentMoveCount( model, selPlayer );
|
||||||
XP_Bool showPending = board->trayVisState == TRAY_REVEALED
|
XP_Bool showPending = board->trayVisState == TRAY_REVEALED
|
||||||
&& curCount > 0;
|
&& curCount > 0;
|
||||||
|
|
||||||
if ( dict != NULL && getCellRect( board, col, row, &cellRect ) ) {
|
|
||||||
|
|
||||||
/* This 'while' is only here so I can 'break' below */
|
/* This 'while' is only here so I can 'break' below */
|
||||||
while ( board->trayVisState == TRAY_HIDDEN ||
|
while ( board->trayVisState == TRAY_HIDDEN ||
|
||||||
!rectContainsRect( &board->trayBounds, &cellRect ) ) {
|
!rectContainsRect( &board->trayBounds, &cellRect ) ) {
|
||||||
|
|
Loading…
Reference in a new issue