Dramatically optimise inserting many items in wxGenericListCtrl.
During each item insertion SetItem() was called and this resulted in a call to GetItemRect() which, in turn, re-laid out all items in the control meaning that the relatively expensive wxListMainWindow::RecalculatePositions() was called N times when inserting N items. Reduce this to just a single call by not refreshing the item in SetItem() if everything is going to be redrawn soon anyhow. This decreases the time needed to insert a couple of thousands of items in icon view from several minutes to less than a second. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3181,11 +3181,15 @@ void wxListMainWindow::SetItem( wxListItem &item )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the item on screen
|
// update the item on screen unless we're going to update everything soon
|
||||||
|
// anyhow
|
||||||
|
if ( !m_dirty )
|
||||||
|
{
|
||||||
wxRect rectItem;
|
wxRect rectItem;
|
||||||
GetItemRect(id, rectItem);
|
GetItemRect(id, rectItem);
|
||||||
RefreshRect(rectItem);
|
RefreshRect(rectItem);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxListMainWindow::SetItemStateAll(long state, long stateMask)
|
void wxListMainWindow::SetItemStateAll(long state, long stateMask)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user