From cc233992dfe0fa9732c24774852d037d161546ce Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 13 Sep 2017 13:20:59 +0200 Subject: clang-tidy modernize-use-emplace in slideshow Change-Id: Ice6ab0dcd6785a751be5a66b262690640e0a2780 Reviewed-on: https://gerrit.libreoffice.org/42239 Tested-by: Jenkins Reviewed-by: Noel Grandin --- slideshow/source/engine/eventqueue.cxx | 5 ++--- slideshow/source/engine/opengl/TransitionImpl.cxx | 14 +++++++------- slideshow/source/engine/pointersymbol.cxx | 2 +- slideshow/source/engine/rehearsetimingsactivity.cxx | 2 +- slideshow/source/engine/screenupdater.cxx | 3 +-- slideshow/source/engine/shapes/drawshape.cxx | 15 ++++++--------- slideshow/source/engine/shapes/drawshapesubsetting.cxx | 16 ++++++++-------- slideshow/source/engine/shapes/gdimtftools.cxx | 3 +-- slideshow/source/engine/shapes/viewshape.cxx | 2 +- slideshow/source/engine/slide/layer.cxx | 5 ++--- slideshow/source/engine/slide/slideimpl.cxx | 5 ++--- slideshow/source/engine/transitions/slidechangebase.cxx | 2 +- slideshow/source/engine/waitsymbol.cxx | 2 +- 13 files changed, 34 insertions(+), 42 deletions(-) (limited to 'slideshow/source') diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index df2ce3cdf3cb..3ecad820b1a7 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -119,9 +119,8 @@ namespace slideshow ENSURE_OR_RETURN_FALSE( rEvent.get() != nullptr, "EventQueue::addEvent: event ptr NULL" ); - maNextEvents.push_back( - EventEntry( rEvent, rEvent->getActivationTime( - mpTimer->getElapsedTime()) ) ); + maNextEvents.emplace_back( rEvent, rEvent->getActivationTime( + mpTimer->getElapsedTime()) ); return true; } diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx index ad83e50b5dc6..706816f55bd4 100644 --- a/slideshow/source/engine/opengl/TransitionImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionImpl.cxx @@ -961,7 +961,7 @@ std::shared_ptr makeRevolvingCircles( sal_uInt16 nCircles , s float TempAngle(0.0); for(unsigned int Point(0); Point < nPointsOnCircles; ++Point) { - unScaledTexCoords.push_back( glm::vec2( cos(TempAngle - 3.1415926/2.0) , sin(TempAngle- 3.1415926/2.0) ) ); + unScaledTexCoords.emplace_back( cos(TempAngle - 3.1415926/2.0) , sin(TempAngle- 3.1415926/2.0) ); TempAngle += dAngle; } @@ -1157,9 +1157,9 @@ void Primitive::pushTriangle(const glm::vec2& SlideLocation0,const glm::vec2& Sl Verts.reserve(3); Texs.reserve(3); - Verts.push_back(glm::vec3( 2*SlideLocation0.x - 1, -2*SlideLocation0.y + 1 , 0.0 )); - Verts.push_back(glm::vec3( 2*SlideLocation1.x - 1, -2*SlideLocation1.y + 1 , 0.0 )); - Verts.push_back(glm::vec3( 2*SlideLocation2.x - 1, -2*SlideLocation2.y + 1 , 0.0 )); + Verts.emplace_back( 2*SlideLocation0.x - 1, -2*SlideLocation0.y + 1 , 0.0 ); + Verts.emplace_back( 2*SlideLocation1.x - 1, -2*SlideLocation1.y + 1 , 0.0 ); + Verts.emplace_back( 2*SlideLocation2.x - 1, -2*SlideLocation2.y + 1 , 0.0 ); //figure out if they're facing the correct way, and make them face the correct way. glm::vec3 Normal( glm::cross( Verts[0] - Verts[1] , Verts[1] - Verts[2] ) ); @@ -1175,9 +1175,9 @@ void Primitive::pushTriangle(const glm::vec2& SlideLocation0,const glm::vec2& Sl Texs.push_back(SlideLocation2); Texs.push_back(SlideLocation1); Verts.clear(); - Verts.push_back(glm::vec3( 2*SlideLocation0.x - 1, -2*SlideLocation0.y + 1 , 0.0 )); - Verts.push_back(glm::vec3( 2*SlideLocation2.x - 1, -2*SlideLocation2.y + 1 , 0.0 )); - Verts.push_back(glm::vec3( 2*SlideLocation1.x - 1, -2*SlideLocation1.y + 1 , 0.0 )); + Verts.emplace_back( 2*SlideLocation0.x - 1, -2*SlideLocation0.y + 1 , 0.0 ); + Verts.emplace_back( 2*SlideLocation2.x - 1, -2*SlideLocation2.y + 1 , 0.0 ); + Verts.emplace_back( 2*SlideLocation1.x - 1, -2*SlideLocation1.y + 1 , 0.0 ); } Vertices.push_back({Verts[0], glm::vec3(0, 0, 1), Texs[0]}); //all normals always face the screen when untransformed. diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index b539cf6a1055..29728a522189 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -128,7 +128,7 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); } - maViews.push_back( ViewsVecT::value_type( rView, sprite ) ); + maViews.emplace_back( rView, sprite ); } void PointerSymbol::viewRemoved( const UnoViewSharedPtr& rView ) diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index 5e66bbc16457..25d4673879c1 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -343,7 +343,7 @@ void RehearseTimingsActivity::viewAdded( const UnoViewSharedPtr& rView ) if( maViews.empty() ) maSpriteRectangle = spriteRectangle; - maViews.push_back( ViewsVecT::value_type( rView, sprite ) ); + maViews.emplace_back( rView, sprite ); if (isActive()) sprite->show(); diff --git a/slideshow/source/engine/screenupdater.cxx b/slideshow/source/engine/screenupdater.cxx index 597da9daf600..33d78598f3ae 100644 --- a/slideshow/source/engine/screenupdater.cxx +++ b/slideshow/source/engine/screenupdater.cxx @@ -99,8 +99,7 @@ namespace internal void ScreenUpdater::notifyUpdate( const UnoViewSharedPtr& rView, bool bViewClobbered ) { - mpImpl->maViewUpdateRequests.push_back( - std::make_pair(rView, bViewClobbered) ); + mpImpl->maViewUpdateRequests.emplace_back(rView, bViewClobbered ); if( bViewClobbered ) mpImpl->mbViewClobbered = true; diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index b0f4a1fa8011..c7ca1f8d4ffe 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -869,17 +869,15 @@ namespace slideshow maHyperlinkIndices.pop_back(); maHyperlinkRegions.pop_back(); } - maHyperlinkIndices.push_back( - HyperlinkIndexPair( nIndex + 1, - -1 /* to be filled below */ ) ); - maHyperlinkRegions.push_back( - HyperlinkRegion( + maHyperlinkIndices.emplace_back( nIndex + 1, + -1 /* to be filled below */ ); + maHyperlinkRegions.emplace_back( basegfx::B2DRectangle(), OUString( reinterpret_cast( pAct->GetData()), pAct->GetDataSize() / sizeof(sal_Unicode) ) - ) ); + ); } else if (pAct->GetComment().equalsIgnoreAsciiCase("FIELD_SEQ_END") && // pending end is expected: @@ -977,12 +975,11 @@ namespace slideshow for( const auto& cp : maHyperlinkRegions ) { basegfx::B2DRange const& relRegion( cp.first ); - aTranslatedRegions.push_back( - std::make_pair( + aTranslatedRegions.emplace_back( basegfx::B2DRange( relRegion.getMinimum() + rOffset, relRegion.getMaximum() + rOffset), - cp.second) ); + cp.second ); } return aTranslatedRegions; diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx b/slideshow/source/engine/shapes/drawshapesubsetting.cxx index b94624681233..1de7934719d9 100644 --- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx +++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx @@ -185,19 +185,19 @@ namespace slideshow { // non-subsetted node, with some child subsets // that subtract from it - maCurrentSubsets.push_back( DocTreeNode( 0, - mnMinSubsetActionIndex ) ); - maCurrentSubsets.push_back( DocTreeNode( mnMaxSubsetActionIndex, - maActionClassVector.size() ) ); + maCurrentSubsets.emplace_back( 0, + mnMinSubsetActionIndex ); + maCurrentSubsets.emplace_back( mnMaxSubsetActionIndex, + maActionClassVector.size() ); } else { // subsetted node, from which some further child // subsets subtract content - maCurrentSubsets.push_back( DocTreeNode( maSubset.getStartIndex(), - mnMinSubsetActionIndex ) ); - maCurrentSubsets.push_back( DocTreeNode( mnMaxSubsetActionIndex, - maSubset.getEndIndex() ) ); + maCurrentSubsets.emplace_back( maSubset.getStartIndex(), + mnMinSubsetActionIndex ); + maCurrentSubsets.emplace_back( mnMaxSubsetActionIndex, + maSubset.getEndIndex() ); } } else diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index fb12c9853392..1901011a18ac 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -387,8 +387,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, if( nWaitTime100thSeconds == 0 ) nWaitTime100thSeconds = 10; - o_rFrames.push_back( MtfAnimationFrame( pMtf, - nWaitTime100thSeconds / 100.0 ) ); + o_rFrames.emplace_back( pMtf, nWaitTime100thSeconds / 100.0 ); } return !o_rFrames.empty(); diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 449f18116e02..c88d4e85617f 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -755,7 +755,7 @@ namespace slideshow // not yet in cache - add default-constructed cache // entry, to have something to return - maRenderers.push_back( RendererCacheEntry() ); + maRenderers.emplace_back( ); aIter = maRenderers.end()-1; } diff --git a/slideshow/source/engine/slide/layer.cxx b/slideshow/source/engine/slide/layer.cxx index 0aa3352192a8..dd2da81ba1e0 100644 --- a/slideshow/source/engine/slide/layer.cxx +++ b/slideshow/source/engine/slide/layer.cxx @@ -78,9 +78,8 @@ namespace slideshow pNewLayer = rNewView->createViewLayer(maBounds); // add to local list - maViewEntries.push_back( - ViewEntry( rNewView, - pNewLayer )); + maViewEntries.emplace_back( rNewView, + pNewLayer ); return maViewEntries.back().mpViewLayer; } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 0c51937b2b82..45e58d75c934 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -581,9 +581,8 @@ SlideBitmapSharedPtr SlideImpl::getCurrentSlideBitmap( const UnoViewSharedPtr& r void SlideImpl::viewAdded( const UnoViewSharedPtr& rView ) { - maSlideBitmaps.push_back( - std::make_pair( rView, - VectorOfSlideBitmaps(SlideAnimationState_NUM_ENTRIES) )); + maSlideBitmaps.emplace_back( rView, + VectorOfSlideBitmaps(SlideAnimationState_NUM_ENTRIES) ); if( mpLayerManager ) mpLayerManager->viewAdded( rView ); diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index 9ea21486e5ed..6a84032408f6 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -392,7 +392,7 @@ void SlideChangeBase::viewAdded( const UnoViewSharedPtr& rView ) if( mbFinished ) return; - maViewData.push_back( ViewEntry(rView) ); + maViewData.emplace_back(rView ); ViewEntry& rEntry( maViewData.back() ); getEnteringBitmap( rEntry ); diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index aeecd72caa74..9198c6657ed4 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -132,7 +132,7 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) SAL_WARN( "slideshow", comphelper::anyToString( cppu::getCaughtException() ) ); } - maViews.push_back( ViewsVecT::value_type( rView, sprite ) ); + maViews.emplace_back( rView, sprite ); } void WaitSymbol::viewRemoved( const UnoViewSharedPtr& rView ) -- cgit v1.2.3