mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-29 20:34:56 +01:00
TileWidget: avoid a lot of useless repaintings
This commit is contained in:
parent
f6d7661367
commit
ebea504aa7
2 changed files with 7 additions and 4 deletions
|
@ -130,10 +130,8 @@ void BoardWidget::refresh()
|
|||
{
|
||||
if (m_game != NULL)
|
||||
{
|
||||
// XXX: in the future, this code could be changed to use signals
|
||||
// emitted from the core. This would allow repainting only the needed
|
||||
// tiles (the same performance improvement could be done with caching
|
||||
// in the TileWidget class, though)
|
||||
// Note: the TileWidget class will redraw the tile only if something
|
||||
// has changed, to avoid useless repainting.
|
||||
const Board &board = m_game->getBoard();
|
||||
for (unsigned int row = BOARD_MIN; row <= BOARD_MAX; ++row)
|
||||
{
|
||||
|
|
|
@ -108,6 +108,11 @@ int TileWidget::getSquareSize() const
|
|||
|
||||
void TileWidget::tileChanged(const Tile &iTile, bool isJoker, State state)
|
||||
{
|
||||
// This avoids a lot of useless redraws
|
||||
if (m_state == state && m_tile == iTile && m_isJoker == isJoker)
|
||||
return;
|
||||
|
||||
m_state = state;
|
||||
m_tile = iTile;
|
||||
m_isJoker = isJoker;
|
||||
m_state = state;
|
||||
|
|
Loading…
Add table
Reference in a new issue