Loading common/drawframe.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -941,17 +941,19 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU ) void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) { #ifdef KICAD_GAL KiGfx::VIEW* view = m_galCanvas->GetView(); KiGfx::GAL* gal = m_galCanvas->GetGAL(); if( aEnable && m_galCanvasActive ) { // When we switch between GAL based canvases, all we need is a refresh view->RecacheAllItems( true ); m_galCanvas->Refresh(); } if( !( aEnable ^ m_galCanvasActive ) ) return; KiGfx::VIEW* view = m_galCanvas->GetView(); KiGfx::GAL* gal = m_galCanvas->GetGAL(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); // Display the same view after canvas switching Loading Loading @@ -979,6 +981,9 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.Update(); if( aEnable ) view->RecacheAllItems( true ); m_galCanvasActive = aEnable; #endif /* KICAD_GAL */ } common/gal/opengl/opengl_gal.cpp +6 −11 Original line number Diff line number Diff line Loading @@ -403,7 +403,10 @@ void OPENGL_GAL::BeginDrawing() SetFillColor( fillColor ); SetStrokeColor( strokeColor ); isDeleteSavedPixels = true; vboNeedsUpdate = false; // If any of VBO items is dirty - recache everything if( vboNeedsUpdate ) rebuildVbo(); } Loading Loading @@ -455,13 +458,6 @@ void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer ) void OPENGL_GAL::EndDrawing() { // If any of VBO items is dirty - recache everything if( vboNeedsUpdate ) { rebuildVbo(); vboNeedsUpdate = false; } // Draw the remaining contents, blit the main texture to the screen, swap the buffers glFlush(); blitMainTexture( true ); Loading Loading @@ -521,6 +517,8 @@ void OPENGL_GAL::rebuildVbo() delete verticesBuffer; delete indicesBuffer; vboNeedsUpdate = false; #ifdef __WXDEBUG__ prof_end( &totalTime ); Loading Loading @@ -1484,9 +1482,6 @@ void OPENGL_GAL::EndGroup() { vboSize += curVboItem->GetSize(); // TODO this has to be removed in final version rebuildVbo(); isGroupStarted = false; } Loading common/view/view.cpp +37 −6 Original line number Diff line number Diff line Loading @@ -209,8 +209,8 @@ void VIEW::SetGAL( GAL* aGal ) m_painter->SetGAL( m_gal ); // items need to be recached after changing GAL if( m_useGroups ) recacheAllItems(); //if( m_useGroups ) //RecacheAllItems(); // force the new GAL to display the current viewport. SetCenter( m_center ); Loading Loading @@ -387,7 +387,7 @@ struct VIEW::drawItem aItem->setGroup( currentLayer, group ); view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), currentLayer ); gal->EndGroup(); gal->DrawGroup( group ); //gal->DrawGroup( group ); } } else if( aItem->ViewIsVisible() ) Loading Loading @@ -453,10 +453,33 @@ struct VIEW::unlinkItem struct VIEW::recacheItem { recacheItem( VIEW* aView, GAL* aGal, int aLayer, bool aImmediately ) : view( aView ), gal( aGal ), layer( aLayer ), immediately( aImmediately ) { } void operator()( VIEW_ITEM* aItem ) { aItem->deleteGroups(); //aItem->deleteGroups(); /*int prevGroup = aItem->getGroup( layer ); if( prevGroup != -1 ) { gal->DeleteGroup( prevGroup ); }*/ if( immediately ) { int group = gal->BeginGroup(); aItem->setGroup( layer, group ); view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), layer ); gal->EndGroup(); } } VIEW* view; GAL* gal; int layer; bool immediately; }; Loading Loading @@ -571,16 +594,24 @@ void VIEW::clearGroupCache() } void VIEW::recacheAllItems() void VIEW::RecacheAllItems( bool aImmediately ) { BOX2I r; r.SetMaximum(); wxLogDebug( wxT( "RecacheAllItems::immediately: %u" ), aImmediately ); if( aImmediately ) m_gal->BeginDrawing(); for( LayerMapIter i = m_layers.begin(); i != m_layers.end(); ++i ) { VIEW_LAYER* l = & ( ( *i ).second ); recacheItem visitor; recacheItem visitor( this, m_gal, l->id, aImmediately ); l->items->Query( r, visitor ); }; if( aImmediately ) m_gal->EndDrawing(); } include/view/view.h +8 −3 Original line number Diff line number Diff line Loading @@ -294,6 +294,14 @@ public: */ void PartialRedraw(); /** * Function RecacheAllItems() * Rebuilds GAL display lists. * @param aForceNow decides if every item should be instantly recached. Otherwise items are * going to be recached when they become visible. */ void RecacheAllItems( bool aForceNow = false ); /** * Function IsDynamic() * Tells if the VIEW is dynamic (ie. can be changed, for example displaying PCBs in a window) Loading Loading @@ -350,9 +358,6 @@ private: ///* Clears cached GAL display lists void clearGroupCache(); ///* Rebuilds GAL display lists void recacheAllItems(); /// Determines rendering order of layers. Used in display order sorting function. static bool compareRenderingOrder( VIEW_LAYER* i, VIEW_LAYER* j ) { Loading pcbnew/basepcbframe.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -243,8 +243,11 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) view->SetTopLayer( m_Pcb->GetLayer() ); if( m_galCanvasActive ) { view->RecacheAllItems( true ); m_galCanvas->Refresh(); } } #endif } Loading Loading
common/drawframe.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -941,17 +941,19 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU ) void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) { #ifdef KICAD_GAL KiGfx::VIEW* view = m_galCanvas->GetView(); KiGfx::GAL* gal = m_galCanvas->GetGAL(); if( aEnable && m_galCanvasActive ) { // When we switch between GAL based canvases, all we need is a refresh view->RecacheAllItems( true ); m_galCanvas->Refresh(); } if( !( aEnable ^ m_galCanvasActive ) ) return; KiGfx::VIEW* view = m_galCanvas->GetView(); KiGfx::GAL* gal = m_galCanvas->GetGAL(); double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor(); // Display the same view after canvas switching Loading Loading @@ -979,6 +981,9 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable ); m_auimgr.Update(); if( aEnable ) view->RecacheAllItems( true ); m_galCanvasActive = aEnable; #endif /* KICAD_GAL */ }
common/gal/opengl/opengl_gal.cpp +6 −11 Original line number Diff line number Diff line Loading @@ -403,7 +403,10 @@ void OPENGL_GAL::BeginDrawing() SetFillColor( fillColor ); SetStrokeColor( strokeColor ); isDeleteSavedPixels = true; vboNeedsUpdate = false; // If any of VBO items is dirty - recache everything if( vboNeedsUpdate ) rebuildVbo(); } Loading Loading @@ -455,13 +458,6 @@ void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer ) void OPENGL_GAL::EndDrawing() { // If any of VBO items is dirty - recache everything if( vboNeedsUpdate ) { rebuildVbo(); vboNeedsUpdate = false; } // Draw the remaining contents, blit the main texture to the screen, swap the buffers glFlush(); blitMainTexture( true ); Loading Loading @@ -521,6 +517,8 @@ void OPENGL_GAL::rebuildVbo() delete verticesBuffer; delete indicesBuffer; vboNeedsUpdate = false; #ifdef __WXDEBUG__ prof_end( &totalTime ); Loading Loading @@ -1484,9 +1482,6 @@ void OPENGL_GAL::EndGroup() { vboSize += curVboItem->GetSize(); // TODO this has to be removed in final version rebuildVbo(); isGroupStarted = false; } Loading
common/view/view.cpp +37 −6 Original line number Diff line number Diff line Loading @@ -209,8 +209,8 @@ void VIEW::SetGAL( GAL* aGal ) m_painter->SetGAL( m_gal ); // items need to be recached after changing GAL if( m_useGroups ) recacheAllItems(); //if( m_useGroups ) //RecacheAllItems(); // force the new GAL to display the current viewport. SetCenter( m_center ); Loading Loading @@ -387,7 +387,7 @@ struct VIEW::drawItem aItem->setGroup( currentLayer, group ); view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), currentLayer ); gal->EndGroup(); gal->DrawGroup( group ); //gal->DrawGroup( group ); } } else if( aItem->ViewIsVisible() ) Loading Loading @@ -453,10 +453,33 @@ struct VIEW::unlinkItem struct VIEW::recacheItem { recacheItem( VIEW* aView, GAL* aGal, int aLayer, bool aImmediately ) : view( aView ), gal( aGal ), layer( aLayer ), immediately( aImmediately ) { } void operator()( VIEW_ITEM* aItem ) { aItem->deleteGroups(); //aItem->deleteGroups(); /*int prevGroup = aItem->getGroup( layer ); if( prevGroup != -1 ) { gal->DeleteGroup( prevGroup ); }*/ if( immediately ) { int group = gal->BeginGroup(); aItem->setGroup( layer, group ); view->m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), layer ); gal->EndGroup(); } } VIEW* view; GAL* gal; int layer; bool immediately; }; Loading Loading @@ -571,16 +594,24 @@ void VIEW::clearGroupCache() } void VIEW::recacheAllItems() void VIEW::RecacheAllItems( bool aImmediately ) { BOX2I r; r.SetMaximum(); wxLogDebug( wxT( "RecacheAllItems::immediately: %u" ), aImmediately ); if( aImmediately ) m_gal->BeginDrawing(); for( LayerMapIter i = m_layers.begin(); i != m_layers.end(); ++i ) { VIEW_LAYER* l = & ( ( *i ).second ); recacheItem visitor; recacheItem visitor( this, m_gal, l->id, aImmediately ); l->items->Query( r, visitor ); }; if( aImmediately ) m_gal->EndDrawing(); }
include/view/view.h +8 −3 Original line number Diff line number Diff line Loading @@ -294,6 +294,14 @@ public: */ void PartialRedraw(); /** * Function RecacheAllItems() * Rebuilds GAL display lists. * @param aForceNow decides if every item should be instantly recached. Otherwise items are * going to be recached when they become visible. */ void RecacheAllItems( bool aForceNow = false ); /** * Function IsDynamic() * Tells if the VIEW is dynamic (ie. can be changed, for example displaying PCBs in a window) Loading Loading @@ -350,9 +358,6 @@ private: ///* Clears cached GAL display lists void clearGroupCache(); ///* Rebuilds GAL display lists void recacheAllItems(); /// Determines rendering order of layers. Used in display order sorting function. static bool compareRenderingOrder( VIEW_LAYER* i, VIEW_LAYER* j ) { Loading
pcbnew/basepcbframe.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -243,8 +243,11 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) view->SetTopLayer( m_Pcb->GetLayer() ); if( m_galCanvasActive ) { view->RecacheAllItems( true ); m_galCanvas->Refresh(); } } #endif } Loading