Skip calling RTREE::Remove() when adding items to a VIEW

This commit is contained in:
Jon Evans 2017-09-24 21:22:23 -04:00 committed by Maciej Suminski
parent e5df4304a6
commit 9383987b1c
2 changed files with 18 additions and 8 deletions

View File

@ -335,7 +335,7 @@ void VIEW::Add( VIEW_ITEM* aItem, int aDrawPriority )
} }
SetVisible( aItem, true ); SetVisible( aItem, true );
Update( aItem, KIGFX::ALL ); Update( aItem, KIGFX::INITIAL_ADD );
} }
@ -827,7 +827,7 @@ struct VIEW::drawItem
{ {
wxASSERT( aItem->viewPrivData() ); wxASSERT( aItem->viewPrivData() );
// Conditions that have te be fulfilled for an item to be drawn // Conditions that have to be fulfilled for an item to be drawn
bool drawCondition = aItem->viewPrivData()->isRenderable() && bool drawCondition = aItem->viewPrivData()->isRenderable() &&
aItem->ViewGetLOD( layer, view ) < view->m_scale; aItem->ViewGetLOD( layer, view ) < view->m_scale;
if( !drawCondition ) if( !drawCondition )
@ -1076,14 +1076,23 @@ void VIEW::clearGroupCache()
void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ) void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
{ {
// updateLayers updates geometry too, so we do not have to update both of them at the same time if( aUpdateFlags & INITIAL_ADD )
if( aUpdateFlags & LAYERS )
{ {
updateLayers( aItem ); // Don't update layers or bbox, since it was done in VIEW::Add()
// Now that we have initialized, set flags to ALL for the code below
aUpdateFlags = ALL;
} }
else if( aUpdateFlags & GEOMETRY ) else
{ {
updateBbox( aItem ); // updateLayers updates geometry too, so we do not have to update both of them at the same time
if( aUpdateFlags & LAYERS )
{
updateLayers( aItem );
}
else if( aUpdateFlags & GEOMETRY )
{
updateBbox( aItem );
}
} }
int layers[VIEW_MAX_LAYERS], layers_count; int layers[VIEW_MAX_LAYERS], layers_count;

View File

@ -56,7 +56,8 @@ enum VIEW_UPDATE_FLAGS {
COLOR = 0x02, /// Color has changed COLOR = 0x02, /// Color has changed
GEOMETRY = 0x04, /// Position or shape has changed GEOMETRY = 0x04, /// Position or shape has changed
LAYERS = 0x08, /// Layers have changed LAYERS = 0x08, /// Layers have changed
ALL = 0xff INITIAL_ADD = 0x10, /// Item is being added to the view
ALL = 0xef /// All except INITIAL_ADD
}; };
/** /**