Loading common/view/view.cpp +24 −4 Original line number Original line Diff line number Diff line Loading @@ -454,13 +454,21 @@ struct VIEW::drawItem { { GAL* gal = view->GetGAL(); GAL* gal = view->GetGAL(); aItem->ViewGetRequiredLayers( layers, layersCount ); // Conditions that have te be fulfilled for an item to be drawn bool drawCondition = aItem->ViewIsVisible() && aItem->ViewGetLOD( currentLayer->id ) < view->m_scale && view->isEveryLayerEnabled( layers, layersCount ); if( !drawCondition ) return; if( currentLayer->cached ) if( currentLayer->cached ) { { // Draw using cached information or create one // Draw using cached information or create one int group = aItem->getGroup( currentLayer->id ); int group = aItem->getGroup( currentLayer->id ); if( group >= 0 && aItem->ViewIsVisible() && if( group >= 0 ) aItem->ViewGetLOD( currentLayer->id ) < view->m_scale ) { { gal->DrawGroup( group ); gal->DrawGroup( group ); } } Loading @@ -472,8 +480,7 @@ struct VIEW::drawItem gal->EndGroup(); gal->EndGroup(); } } } } else if( aItem->ViewIsVisible() && else aItem->ViewGetLOD( currentLayer->id ) < view->m_scale ) { { // Immediate mode // Immediate mode view->m_painter->Draw( aItem, currentLayer->id ); view->m_painter->Draw( aItem, currentLayer->id ); Loading @@ -482,6 +489,7 @@ struct VIEW::drawItem const VIEW_LAYER* currentLayer; const VIEW_LAYER* currentLayer; VIEW* view; VIEW* view; int layersCount, layers[VIEW_MAX_LAYERS]; }; }; Loading Loading @@ -652,6 +660,18 @@ void VIEW::clearGroupCache() } } bool VIEW::isEveryLayerEnabled( const int aLayers[], int aCount ) const { for( int i = 0; i < aCount; ++i ) { if( !m_layers.at( aLayers[i] ).enabled ) return false; } return true; } void VIEW::RecacheAllItems( bool aImmediately ) void VIEW::RecacheAllItems( bool aImmediately ) { { BOX2I r; BOX2I r; Loading common/view/view_item.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -48,6 +48,13 @@ void VIEW_ITEM::ViewSetVisible( bool aIsVisible ) } } void VIEW_ITEM::ViewGetRequiredLayers( int aLayers[], int& aCount ) const { // By default there is no layer required aCount = 0; } void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw ) void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw ) { { m_view->invalidateItem( this, aUpdateFlags ); m_view->invalidateItem( this, aUpdateFlags ); Loading include/view/view.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -403,6 +403,9 @@ private: return i->renderingOrder > j->renderingOrder; return i->renderingOrder > j->renderingOrder; } } /// Checks if every layer stored in aLayers array is enabled. bool isEveryLayerEnabled( const int aLayers[], int aCount ) const; /// Contains set of possible displayed layers and its properties /// Contains set of possible displayed layers and its properties LayerMap m_layers; LayerMap m_layers; Loading include/view/view_item.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -207,6 +207,16 @@ public: */ */ virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0; virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0; /** * Function ViewGetRequiredLayers() * Returns the all the layers that are required for an item to be drawn. Eg. there is no point * to draw netnames, when the track is not visible - so track layer should be marked as * required. * @param aLayers[]: output layer index array * @param aCount: number of layer indices in aLayers[] */ virtual void ViewGetRequiredLayers( int aLayers[], int& aCount ) const; /** /** * Function ViewSetVisible() * Function ViewSetVisible() * Sets the item visibility. * Sets the item visibility. Loading Loading
common/view/view.cpp +24 −4 Original line number Original line Diff line number Diff line Loading @@ -454,13 +454,21 @@ struct VIEW::drawItem { { GAL* gal = view->GetGAL(); GAL* gal = view->GetGAL(); aItem->ViewGetRequiredLayers( layers, layersCount ); // Conditions that have te be fulfilled for an item to be drawn bool drawCondition = aItem->ViewIsVisible() && aItem->ViewGetLOD( currentLayer->id ) < view->m_scale && view->isEveryLayerEnabled( layers, layersCount ); if( !drawCondition ) return; if( currentLayer->cached ) if( currentLayer->cached ) { { // Draw using cached information or create one // Draw using cached information or create one int group = aItem->getGroup( currentLayer->id ); int group = aItem->getGroup( currentLayer->id ); if( group >= 0 && aItem->ViewIsVisible() && if( group >= 0 ) aItem->ViewGetLOD( currentLayer->id ) < view->m_scale ) { { gal->DrawGroup( group ); gal->DrawGroup( group ); } } Loading @@ -472,8 +480,7 @@ struct VIEW::drawItem gal->EndGroup(); gal->EndGroup(); } } } } else if( aItem->ViewIsVisible() && else aItem->ViewGetLOD( currentLayer->id ) < view->m_scale ) { { // Immediate mode // Immediate mode view->m_painter->Draw( aItem, currentLayer->id ); view->m_painter->Draw( aItem, currentLayer->id ); Loading @@ -482,6 +489,7 @@ struct VIEW::drawItem const VIEW_LAYER* currentLayer; const VIEW_LAYER* currentLayer; VIEW* view; VIEW* view; int layersCount, layers[VIEW_MAX_LAYERS]; }; }; Loading Loading @@ -652,6 +660,18 @@ void VIEW::clearGroupCache() } } bool VIEW::isEveryLayerEnabled( const int aLayers[], int aCount ) const { for( int i = 0; i < aCount; ++i ) { if( !m_layers.at( aLayers[i] ).enabled ) return false; } return true; } void VIEW::RecacheAllItems( bool aImmediately ) void VIEW::RecacheAllItems( bool aImmediately ) { { BOX2I r; BOX2I r; Loading
common/view/view_item.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -48,6 +48,13 @@ void VIEW_ITEM::ViewSetVisible( bool aIsVisible ) } } void VIEW_ITEM::ViewGetRequiredLayers( int aLayers[], int& aCount ) const { // By default there is no layer required aCount = 0; } void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw ) void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw ) { { m_view->invalidateItem( this, aUpdateFlags ); m_view->invalidateItem( this, aUpdateFlags ); Loading
include/view/view.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -403,6 +403,9 @@ private: return i->renderingOrder > j->renderingOrder; return i->renderingOrder > j->renderingOrder; } } /// Checks if every layer stored in aLayers array is enabled. bool isEveryLayerEnabled( const int aLayers[], int aCount ) const; /// Contains set of possible displayed layers and its properties /// Contains set of possible displayed layers and its properties LayerMap m_layers; LayerMap m_layers; Loading
include/view/view_item.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -207,6 +207,16 @@ public: */ */ virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0; virtual void ViewGetLayers( int aLayers[], int& aCount ) const = 0; /** * Function ViewGetRequiredLayers() * Returns the all the layers that are required for an item to be drawn. Eg. there is no point * to draw netnames, when the track is not visible - so track layer should be marked as * required. * @param aLayers[]: output layer index array * @param aCount: number of layer indices in aLayers[] */ virtual void ViewGetRequiredLayers( int aLayers[], int& aCount ) const; /** /** * Function ViewSetVisible() * Function ViewSetVisible() * Sets the item visibility. * Sets the item visibility. Loading