Fix clipping of cell contents in wxGrid
Use wxDCClipper, now that it doesn't lose the previously set clipping region any more, in wxGridCellStringRenderer::Draw() to ensure that we don't overflow the area allocated for the cell. Closes #17872.
This commit is contained in:
@@ -1871,7 +1871,10 @@ void wxGrid::Render( wxDC& dc,
|
|||||||
dc.DrawRectangle( pointOffSet, sizeCells );
|
dc.DrawRectangle( pointOffSet, sizeCells );
|
||||||
|
|
||||||
// draw cells
|
// draw cells
|
||||||
DrawGridCellArea( dc, renderCells );
|
{
|
||||||
|
wxDCClipper clipper( dc, wxRect(pointOffSet, sizeCells) );
|
||||||
|
DrawGridCellArea( dc, renderCells );
|
||||||
|
}
|
||||||
|
|
||||||
// draw grid lines
|
// draw grid lines
|
||||||
if ( style & wxGRID_DRAW_CELL_LINES )
|
if ( style & wxGRID_DRAW_CELL_LINES )
|
||||||
|
@@ -630,8 +630,7 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
|
|||||||
for (int i = col + cell_cols; i <= col_end; i++)
|
for (int i = col + cell_cols; i <= col_end; i++)
|
||||||
{
|
{
|
||||||
clip.width = grid.GetColSize(i) - 1;
|
clip.width = grid.GetColSize(i) - 1;
|
||||||
dc.DestroyClippingRegion();
|
wxDCClipper clipper(dc, clip);
|
||||||
dc.SetClippingRegion(clip);
|
|
||||||
|
|
||||||
SetTextColoursAndFont(grid, attr, dc,
|
SetTextColoursAndFont(grid, attr, dc,
|
||||||
grid.IsInSelection(row,i));
|
grid.IsInSelection(row,i));
|
||||||
@@ -644,7 +643,6 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
|
|||||||
rect = rectCell;
|
rect = rectCell;
|
||||||
rect.Inflate(-1);
|
rect.Inflate(-1);
|
||||||
rect.width++;
|
rect.width++;
|
||||||
dc.DestroyClippingRegion();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user