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:
@@ -3167,16 +3167,20 @@ wxArrayInt wxGrid::CalcColLabelsExposed( const wxRegion& reg ) const
|
|||||||
|
|
||||||
wxGridCellCoordsArray wxGrid::CalcCellsExposed( const wxRegion& reg ) const
|
wxGridCellCoordsArray wxGrid::CalcCellsExposed( const wxRegion& reg ) const
|
||||||
{
|
{
|
||||||
wxRegionIterator iter( reg );
|
|
||||||
wxRect r;
|
wxRect r;
|
||||||
|
|
||||||
wxGridCellCoordsArray cellsExposed;
|
wxGridCellCoordsArray cellsExposed;
|
||||||
|
|
||||||
int left, top, right, bottom;
|
int left, top, right, bottom;
|
||||||
while ( iter )
|
for ( wxRegionIterator iter(reg); iter; ++iter )
|
||||||
{
|
{
|
||||||
r = iter.GetRect();
|
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...
|
// TODO: remove this when we can...
|
||||||
// There is a bug in wxMotif that gives garbage update
|
// There is a bug in wxMotif that gives garbage update
|
||||||
// rectangles if you jump-scroll a long way by clicking the
|
// 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++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
cellsExposed.Add(wxGridCellCoords(row, cols[n]));
|
cellsExposed.Add(wxGridCellCoords(row, cols[n]));
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cellsExposed;
|
return cellsExposed;
|
||||||
|
Reference in New Issue
Block a user