Optimization: skip 0-sized cells in wxGrid::CalcCellsExposed().

There is no need to compute intersections with 0-sized cells, skip them to
speed up refresh of big grids.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-08-03 15:36:25 +00:00
parent ea805d32e4
commit 9e57072a90

View File

@@ -3167,16 +3167,20 @@ wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg ) const
wxGridCellCoordsArray wxGrid::CalcCellsExposed( const wxRegion& reg ) const
{
wxRegionIterator iter( reg );
wxRect r;
wxGridCellCoordsArray cellsExposed;
int left, top, right, bottom;
while ( iter )
for ( wxRegionIterator iter(reg); iter; ++iter )
{
r = iter.GetRect();
// Skip 0-height cells, they're invisible anyhow, don't waste time
// getting their rectangles and so on.
if ( !r.GetHeight() )
continue;
// TODO: remove this when we can...
// There is a bug in wxMotif that gives garbage update
// rectangles if you jump-scroll a long way by clicking the
@@ -3224,8 +3228,6 @@ wxGridCellCoordsArray wxGrid::CalcCellsExposed( const wxRegion& reg ) const
for ( size_t n = 0; n < count; n++ )
cellsExposed.Add(wxGridCellCoords(row, cols[n]));
}
++iter;
}
return cellsExposed;