From 599059561958dc8ccac0ea6db5a7fa3e9fd67287 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 19 Sep 2022 16:39:17 +0200 Subject: [PATCH] When adding a bitmap, do not clone it during moving. Cloning is not necessary, and is memory consuming. --- eeschema/tools/sch_drawing_tools.cpp | 6 +++--- pcbnew/tools/drawing_tool.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index af9abf7881..0d24c944ce 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -458,7 +458,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) { image->SetPosition( getViewControls()->GetCursorPosition() ); m_view->ClearPreview(); - m_view->AddToPreview( image->Clone() ); + m_view->AddToPreview( image, false ); // Add, but not give ownership } m_frame->PushTool( aEvent ); @@ -607,7 +607,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) m_frame->SaveCopyForRepeatItem( image ); 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_selectionTool->AddItemToSel( image ); @@ -642,7 +642,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) { image->SetPosition( cursorPos ); 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_frame->SetMsgPanel( image ); } diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 37c8b1607b..3ececdb85f 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -546,7 +546,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent ) { image->SetPosition( cursorPos ); m_view->ClearPreview(); - m_view->AddToPreview( image->Clone() ); + m_view->AddToPreview( image, false ); // Add, but not give ownership } m_frame->PushTool( aEvent ); @@ -688,7 +688,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent ) image->SetLayer( m_frame->GetActiveLayer() ); 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 selectionTool->AddItemToSel( image, false ); @@ -727,7 +727,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent ) { image->SetPosition( cursorPos ); 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 } else if( image && evt->IsAction( &ACTIONS::doDelete ) )