Optimize hot loop in UpdateItems.

This commit is contained in:
Alex 2022-11-19 04:02:05 +05:00
parent 11dddefd05
commit d3aed6c408
1 changed files with 8 additions and 7 deletions

View File

@ -1401,7 +1401,7 @@ void VIEW::UpdateItems()
return; return;
unsigned int cntGeomUpdate = 0; unsigned int cntGeomUpdate = 0;
unsigned int cntAnyUpdate = 0; bool anyUpdated = false;
for( VIEW_ITEM* item : *m_allItems ) for( VIEW_ITEM* item : *m_allItems )
{ {
@ -1410,13 +1410,14 @@ void VIEW::UpdateItems()
if( !vpd ) if( !vpd )
continue; continue;
if( vpd->m_requiredUpdate != NONE )
{
anyUpdated = true;
if( vpd->m_requiredUpdate & ( GEOMETRY | LAYERS ) ) if( vpd->m_requiredUpdate & ( GEOMETRY | LAYERS ) )
{ {
cntGeomUpdate++; cntGeomUpdate++;
} }
if( vpd->m_requiredUpdate != NONE )
{
cntAnyUpdate++;
} }
} }
@ -1456,7 +1457,7 @@ void VIEW::UpdateItems()
} }
} }
if( cntAnyUpdate ) if( anyUpdated )
{ {
GAL_UPDATE_CONTEXT ctx( m_gal ); GAL_UPDATE_CONTEXT ctx( m_gal );