Redraw overflowed wxGrid cells to update the background

Before drawing the overflowing text we need to redraw the cells it
overflows into to avoid visual artefacts, that could appear even just
due to drawing new text over the same existing text due to
anti-aliasing. E.g. the text in the cell B2 in the grid sample visibly
changed appearance when repeatedly switching the current cell from A1 to
A2 and back again, just due to redrawing A2 contents.

Closes https://github.com/wxWidgets/wxWidgets/pull/1729
This commit is contained in:
Ilya Sinitsyn
2020-02-06 22:00:55 +07:00
committed by Vadim Zeitlin
parent a2b39f782b
commit 249e5add7e

View File

@@ -650,6 +650,10 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
col_end = grid.GetNumberCols() - 1; col_end = grid.GetNumberCols() - 1;
for (int i = col + cell_cols; i <= col_end; i++) for (int i = col + cell_cols; i <= col_end; i++)
{ {
// redraw the cell to update the background
wxGridCellCoords coords(row, i);
grid.DrawCell(dc, coords);
clip.width = grid.GetColSize(i) - 1; clip.width = grid.GetColSize(i) - 1;
wxDCClipper clipper(dc, clip); wxDCClipper clipper(dc, clip);