// which would lead to some very bad issues.
if (model == null)
throw new NullPointerException();
CellCoord lastBeforeRefresh = lastInsertedCell;
// We do not set up the last inserted cell coordinates
// now as we do not want to have a circled element before
// it is dropped.
lastInsertedCell = null;
CellCoord last = getLastInsertedChip(model);
for (int i = 0, len1 = playerMarks.length; i < len1; i++)
{
for (int j = 0, len2 = playerMarks[i].length; j < len2; j++)
{
playerMarks[i][j] = model.getCell(i, j);
}
}
int cellWidth = getCellWidth();
int cellHeight = getCellHeight();
// Play a small animation in order to drop chips.
// if there's a drop to display.
if (last != null)
{
displayAnimation(model, last);
// We delete the circle of the last inserted cell when possible.
if (lastBeforeRefresh != null)
{
paintImmediately(new Rectangle(lastBeforeRefresh.getColIndex() * cellWidth,
lastBeforeRefresh.getRowIndex() * cellHeight,
cellWidth, cellHeight));
}
}
// Now that the animation is successful, we can copy
// the parameters so that it is taken into account by
// the paint() method.
lastInsertedCell = last;
gameModel = model;
// OpenJDK speed improvement : we only paint the last inserted chip when
// this is possible...
if (last != null && gameModel != null && gameModel.getGameStatus().equals(GameStatus.CONTINUE_STATUS))
{
paintImmediately(new Rectangle(last.getColIndex() * cellWidth, last.getRowIndex() * cellHeight,
cellWidth, cellHeight));
}
else
{
repaint();