canvas/source/opengl/ogl_canvashelper.cxx | 27 +++++++++------------------ svx/source/svdraw/svdmrkv.cxx | 8 ++++---- 2 files changed, 13 insertions(+), 22 deletions(-)
New commits: commit a4035d7667cf096a11e26cb95f1c42c3f03fd89f Author: Mike Kaganski <[email protected]> AuthorDate: Thu Nov 20 11:00:46 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Nov 20 09:40:05 2025 +0100 Use emplace_back() instead of push_back(Action()) + back() Change-Id: I1ee0d7d292326dcf4e937c4e5e585b5fd56b69e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194231 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index 53b0702cd6e7..f7416b0b0ebd 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -385,8 +385,7 @@ namespace oglcanvas { if( mpDevice ) { - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); @@ -413,8 +412,7 @@ namespace oglcanvas if( !mpDevice ) return; - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); @@ -444,8 +442,7 @@ namespace oglcanvas if( mpDevice ) { - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); rAct.maPolyPolys.push_back( @@ -470,8 +467,7 @@ namespace oglcanvas if( mpDevice ) { - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); rAct.maPolyPolys.push_back( @@ -529,8 +525,7 @@ namespace oglcanvas if( mpDevice ) { - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); rAct.maPolyPolys.push_back( @@ -555,8 +550,7 @@ namespace oglcanvas if( mpDevice ) { - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); rAct.maPolyPolys.push_back( @@ -761,8 +755,7 @@ namespace oglcanvas // set font pVDev->SetFont(aFont); - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); @@ -824,8 +817,7 @@ namespace oglcanvas // insert as transformed copy of bitmap action vector - // during rendering, this gets rendered into a temporary // buffer, and then composited to the front - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); @@ -862,8 +854,7 @@ namespace oglcanvas aPixelData, canvastools::getStdColorSpace())); - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); + Action& rAct=mpRecordedActions->emplace_back(); setupGraphicsState( rAct, viewState, renderState ); commit 47da2ff20e94706a393e3b05c3bec16688b960b4 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Nov 20 07:59:36 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Nov 20 09:39:55 2025 +0100 Avoid some std::string creation Don't use its c_str(), where std::string argument is expected. Use C++20 stringstream::view(). Also: don't use a _ostr literal, where a simple string literal is OK. Change-Id: I659d683f6a988a4eddbef2d37d9011cc2b15076f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194235 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 19e8b92d1a48..2349e644496b 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1210,12 +1210,12 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S selectedNode = &others; } std::string sKind = std::to_string(kind); - boost::optional< boost::property_tree::ptree& > kindNode = selectedNode->get_child_optional(sKind.c_str()); + boost::optional< boost::property_tree::ptree& > kindNode = selectedNode->get_child_optional(sKind); if (!kindNode) { boost::property_tree::ptree newChild; newChild.push_back(node); - selectedNode->add_child(sKind.c_str(), newChild); + selectedNode->add_child(sKind, newChild); } else kindNode.get().push_back(node); @@ -1228,12 +1228,12 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S responseJSON.add_child("kinds", nodes); std::stringstream aStream; boost::property_tree::write_json(aStream, responseJSON, /*pretty=*/ false); - handleArrayStr = ", \"handles\":"_ostr + aStream.str().c_str(); + handleArrayStr = OString::Concat(", \"handles\":") + aStream.view(); if (bConnectorSelection) { aStream.str(""); boost::property_tree::write_json(aStream, aGluePointsTree, /*pretty=*/ false); - handleArrayStr += ", \"GluePoints\":"_ostr + aStream.str().c_str(); + handleArrayStr += OString::Concat(", \"GluePoints\":") + aStream.view(); } }
