Commit 62ea71fc authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Fixed layers caching settings. Added some comments.

parent e050133c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ TOOL_ID TOOL_MANAGER::MakeToolId( const std::string& aToolName )
	return currentId++;
}


void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KiGfx::VIEW* aView,
                                   KiGfx::VIEW_CONTROLS* aViewControls, wxWindow* aFrame )
{
+12 −6
Original line number Diff line number Diff line
@@ -544,7 +544,8 @@ void VIEW::redrawRect( const BOX2I& aRect )
    }
}

bool VIEW::IsDirty()

bool VIEW::IsDirty() const
{
    BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
    {
@@ -554,6 +555,7 @@ bool VIEW::IsDirty()
    return false;
}


struct VIEW::unlinkItem
{
    void operator()( VIEW_ITEM* aItem )
@@ -644,26 +646,30 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )

    for( int i = 0; i < layer_count; i++ )
    {
        // Iterate through the layers used by the item
        if( m_layers.find( layer_indices[i] ) != m_layers.end() )
        {
            VIEW_LAYER* l = &m_layers[layer_indices[i]];

            // Mark the area occupied by the item as dirty
            l->dirtyExtents =
                l->isDirty ? aItem->ViewBBox() : l->dirtyExtents.Merge( aItem->ViewBBox() );

            l->isDirty = true;

            // If geometry has to be updated, then we need to reinsert the item
            if( aUpdateFlags & VIEW_ITEM::GEOMETRY )
            {
                l->items->Remove( aItem );
                l->items->Insert( aItem );    /* reinsert */
                aItem->deleteGroups();
                l->items->Insert( aItem );
            }
        }
    }

    // Remove all the groups, so the item will be recached
    if( aItem->storesGroups() )
    {
        // Clear the cached groups stored in GAL
        std::vector<int> groups = aItem->getAllGroups();
        for( std::vector<int>::iterator i = groups.begin(); i != groups.end(); i++ )
        {
+3 −6
Original line number Diff line number Diff line
@@ -123,13 +123,10 @@ void VIEW_ITEM::setGroup( int aLayer, int aId )


void VIEW_ITEM::deleteGroups()
{
    if( m_groupsSize > 0 )
{
    delete[] m_groups;
    m_groupsSize = 0;
}
}


bool VIEW_ITEM::storesGroups() const
+1 −2
Original line number Diff line number Diff line
@@ -99,7 +99,6 @@ protected:
                                                 ///< using GAL
    KiGfx::WX_VIEW_CONTROLS* m_viewControls;     ///< Control for VIEW (moving, zooming, etc.)
    GalType                  m_currentGal;       ///< Currently used GAL
    wxLongLong               m_timeStamp;
    TOOL_DISPATCHER*         m_eventDispatcher;
};

+6 −1
Original line number Diff line number Diff line
@@ -371,7 +371,12 @@ public:
     */
    bool IsDynamic() const { return m_dynamic; }

    bool IsDirty();
    /**
     * Function IsDirty()
     * Returns true if any of the VIEW layers needs to be refreshened.
     * @return True in case if any of layers is marked as dirty.
     */
    bool IsDirty() const;

    static const int VIEW_MAX_LAYERS = 128;       ///* maximum number of layers that may be shown

Loading