When adding a bitmap, do not clone it during moving.

Cloning is not necessary, and is memory consuming.
This commit is contained in:
jean-pierre charras 2022-09-19 16:39:17 +02:00
parent a23b9810e1
commit 5990595619
2 changed files with 6 additions and 6 deletions

View File

@ -458,7 +458,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
{ {
image->SetPosition( getViewControls()->GetCursorPosition() ); image->SetPosition( getViewControls()->GetCursorPosition() );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( image->Clone() ); m_view->AddToPreview( image, false ); // Add, but not give ownership
} }
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -607,7 +607,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_frame->SaveCopyForRepeatItem( image ); m_frame->SaveCopyForRepeatItem( image );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( image->Clone() ); m_view->AddToPreview( image, false ); // Add, but not give ownership
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
m_selectionTool->AddItemToSel( image ); m_selectionTool->AddItemToSel( image );
@ -642,7 +642,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
{ {
image->SetPosition( cursorPos ); image->SetPosition( cursorPos );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( image->Clone() ); m_view->AddToPreview( image, false ); // Add, but not give ownership
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
m_frame->SetMsgPanel( image ); m_frame->SetMsgPanel( image );
} }

View File

@ -546,7 +546,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
{ {
image->SetPosition( cursorPos ); image->SetPosition( cursorPos );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( image->Clone() ); m_view->AddToPreview( image, false ); // Add, but not give ownership
} }
m_frame->PushTool( aEvent ); m_frame->PushTool( aEvent );
@ -688,7 +688,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
image->SetLayer( m_frame->GetActiveLayer() ); image->SetLayer( m_frame->GetActiveLayer() );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( image->Clone() ); m_view->AddToPreview( image, false ); // Add, but not give ownership
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
selectionTool->AddItemToSel( image, false ); selectionTool->AddItemToSel( image, false );
@ -727,7 +727,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
{ {
image->SetPosition( cursorPos ); image->SetPosition( cursorPos );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( image->Clone() ); m_view->AddToPreview( image, false ); // Add, but not give ownership
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
} }
else if( image && evt->IsAction( &ACTIONS::doDelete ) ) else if( image && evt->IsAction( &ACTIONS::doDelete ) )