Remove duplicated HasValue() call from wxGTK wxDataViewCtrl code

HasValue() is already called by PrepareForItem(), so there is no need to
call it explicitly from wxGTK code, just rely on PrepareForItem()
returning false if there is no value to show -- we can skip the call to
GtkSetCurrentItem() in this case, this function is cheap, and we lose
more by calling HasValue() twice in the common case than we save on not
calling it.

No real changes.
This commit is contained in:
Vadim Zeitlin
2022-05-08 18:24:01 +02:00
parent 610eeb476b
commit 8aefedcb45

View File

@@ -3225,13 +3225,10 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel();
gboolean visible = wx_model->HasValue(item, column);
if ( visible )
{
cell->GtkSetCurrentItem(item);
cell->GtkSetCurrentItem(item);
visible = cell->PrepareForItem(wx_model, item, column);
}
// Cells without values shouldn't be rendered at all.
const bool visible = cell->PrepareForItem(wx_model, item, column);
wxGtkValue gvalue( G_TYPE_BOOLEAN );
g_value_set_boolean( gvalue, visible );