wxDVC: Don't calculate hidden columns' widths

Don't call wxDataViewColumn::GetWidth() in OnPaint() for columns that
are hidden: they won't be drawn and their width won't affect anything.
The call looks deceptively simple, but may invoke best width
recalculation that can be very expensive on large models.
This commit is contained in:
Václav Slavík
2019-05-08 18:28:34 +02:00
parent f60dc84534
commit 560a81b913

View File

@@ -2508,11 +2508,13 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
for (unsigned int i = col_start; i < col_last; i++) for (unsigned int i = col_start; i < col_last; i++)
{ {
wxDataViewColumn *col = GetOwner()->GetColumnAt( i ); wxDataViewColumn *col = GetOwner()->GetColumnAt( i );
if ( col->IsHidden() )
continue; // skip it!
wxDataViewRenderer *cell = col->GetRenderer(); wxDataViewRenderer *cell = col->GetRenderer();
cell_rect.width = col->GetWidth(); cell_rect.width = col->GetWidth();
if ( cell_rect.width <= 0 )
if ( col->IsHidden() || cell_rect.width <= 0 ) continue;
continue; // skip it!
cell_rect.y = first_line_start; cell_rect.y = first_line_start;
for (unsigned int item = item_start; item < item_last; item++) for (unsigned int item = item_start; item < item_last; item++)