From 175a2063effa1c5a3eab896c6c4b0d07f3588edb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 10 Jan 2020 12:30:24 +0200 Subject: use more std::make_shared found using 'git grep', I tried using clang-tidy, but it only successfully found a tiny fraction of these Change-Id: I61c7d85105ff7a911722750e759d6641d578da33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cppcanvas/source/mtfrenderer/bitmapaction.cxx | 15 ++++---- cppcanvas/source/mtfrenderer/lineaction.cxx | 8 ++--- cppcanvas/source/mtfrenderer/pointaction.cxx | 4 +-- cppcanvas/source/mtfrenderer/polypolyaction.cxx | 24 ++++++------- cppcanvas/source/mtfrenderer/textaction.cxx | 42 +++++++++++----------- .../source/mtfrenderer/transparencygroupaction.cxx | 12 +++---- 6 files changed, 50 insertions(+), 55 deletions(-) (limited to 'cppcanvas/source/mtfrenderer') diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx index 94489145faed..84946014ef0b 100644 --- a/cppcanvas/source/mtfrenderer/bitmapaction.cxx +++ b/cppcanvas/source/mtfrenderer/bitmapaction.cxx @@ -201,10 +201,7 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr( new BitmapAction(rBmpEx, - rDstPoint, - rCanvas, - rState ) ); + return std::make_shared(rBmpEx, rDstPoint, rCanvas, rState ); } std::shared_ptr BitmapActionFactory::createBitmapAction( const ::BitmapEx& rBmpEx, @@ -213,11 +210,11 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr( new BitmapAction(rBmpEx, - rDstPoint, - rDstSize, - rCanvas, - rState ) ); + return std::make_shared(rBmpEx, + rDstPoint, + rDstSize, + rCanvas, + rState ); } } } diff --git a/cppcanvas/source/mtfrenderer/lineaction.cxx b/cppcanvas/source/mtfrenderer/lineaction.cxx index 7b0ba2080cf3..e032432e6848 100644 --- a/cppcanvas/source/mtfrenderer/lineaction.cxx +++ b/cppcanvas/source/mtfrenderer/lineaction.cxx @@ -145,10 +145,10 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr( new LineAction( rStartPoint, - rEndPoint, - rCanvas, - rState) ); + return std::make_shared( rStartPoint, + rEndPoint, + rCanvas, + rState); } } diff --git a/cppcanvas/source/mtfrenderer/pointaction.cxx b/cppcanvas/source/mtfrenderer/pointaction.cxx index 03000f85b329..38896151b52e 100644 --- a/cppcanvas/source/mtfrenderer/pointaction.cxx +++ b/cppcanvas/source/mtfrenderer/pointaction.cxx @@ -160,7 +160,7 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr( new PointAction( rPoint, rCanvas, rState ) ); + return std::make_shared( rPoint, rCanvas, rState ); } std::shared_ptr PointActionFactory::createPointAction( const ::basegfx::B2DPoint& rPoint, @@ -168,7 +168,7 @@ namespace cppcanvas const OutDevState& rState, const ::Color& rColor ) { - return std::shared_ptr( new PointAction( rPoint, rCanvas, rState, rColor ) ); + return std::make_shared( rPoint, rCanvas, rState, rColor ); } } } diff --git a/cppcanvas/source/mtfrenderer/polypolyaction.cxx b/cppcanvas/source/mtfrenderer/polypolyaction.cxx index 8fa1582b82c9..15fa4f5bc776 100644 --- a/cppcanvas/source/mtfrenderer/polypolyaction.cxx +++ b/cppcanvas/source/mtfrenderer/polypolyaction.cxx @@ -454,9 +454,9 @@ namespace cppcanvas { OSL_ENSURE( rState.isLineColorSet || rState.isFillColorSet, "PolyPolyActionFactory::createPolyPolyAction() with empty line and fill color" ); - return std::shared_ptr( new PolyPolyAction( rPoly, rCanvas, rState, - rState.isFillColorSet, - rState.isLineColorSet ) ); + return std::make_shared( rPoly, rCanvas, rState, + rState.isFillColorSet, + rState.isLineColorSet ); } std::shared_ptr PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -464,7 +464,7 @@ namespace cppcanvas const OutDevState& rState, const rendering::Texture& rTexture ) { - return std::shared_ptr( new TexturedPolyPolyAction( rPoly, rCanvas, rState, rTexture ) ); + return std::make_shared( rPoly, rCanvas, rState, rTexture ); } std::shared_ptr PolyPolyActionFactory::createLinePolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -474,9 +474,9 @@ namespace cppcanvas OSL_ENSURE( rState.isLineColorSet, "PolyPolyActionFactory::createLinePolyPolyAction() called with empty line color" ); - return std::shared_ptr( new PolyPolyAction( rPoly, rCanvas, rState, - false, - rState.isLineColorSet ) ); + return std::make_shared( rPoly, rCanvas, rState, + false, + rState.isLineColorSet ); } std::shared_ptr PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -486,7 +486,7 @@ namespace cppcanvas { OSL_ENSURE( rState.isLineColorSet, "PolyPolyActionFactory::createPolyPolyAction() for strokes called with empty line color" ); - return std::shared_ptr( new StrokedPolyPolyAction( rPoly, rCanvas, rState, rStrokeAttributes ) ); + return std::make_shared( rPoly, rCanvas, rState, rStrokeAttributes ); } std::shared_ptr PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly, @@ -496,10 +496,10 @@ namespace cppcanvas { OSL_ENSURE( rState.isLineColorSet || rState.isFillColorSet, "PolyPolyActionFactory::createPolyPolyAction() with empty line and fill color" ); - return std::shared_ptr( new PolyPolyAction( rPoly, rCanvas, rState, - rState.isFillColorSet, - rState.isLineColorSet, - nTransparency ) ); + return std::make_shared( rPoly, rCanvas, rState, + rState.isFillColorSet, + rState.isLineColorSet, + nTransparency ); } } diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index f2b50e198606..93e54c11dba5 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -2075,8 +2075,7 @@ namespace cppcanvas if( rParms.maTextTransformation ) { - return std::shared_ptr( - new OutlineAction( + return std::make_shared( rStartPoint, rReliefOffset, rReliefColor, @@ -2088,12 +2087,11 @@ namespace cppcanvas rVDev, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); } else { - return std::shared_ptr( - new OutlineAction( + return std::make_shared( rStartPoint, rReliefOffset, rReliefColor, @@ -2104,7 +2102,7 @@ namespace cppcanvas aCharWidthSeq, rVDev, rCanvas, - rState ) ); + rState ); } } @@ -2192,31 +2190,31 @@ namespace cppcanvas // nope if( rParms.maTextTransformation ) { - ret = std::shared_ptr( new TextAction( + ret = std::make_shared( aStartPoint, rText, nStartPos, nLen, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); } else { - ret = std::shared_ptr( new TextAction( + ret = std::make_shared( aStartPoint, rText, nStartPos, nLen, rCanvas, - rState ) ); + rState ); } } else { // at least one of the effects requested if( rParms.maTextTransformation ) - ret = std::shared_ptr( new EffectTextAction( + ret = std::make_shared( aStartPoint, aReliefOffset, rReliefColor, @@ -2229,9 +2227,9 @@ namespace cppcanvas rVDev, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); else - ret = std::shared_ptr( new EffectTextAction( + ret = std::make_shared( aStartPoint, aReliefOffset, rReliefColor, @@ -2243,7 +2241,7 @@ namespace cppcanvas nLen, rVDev, rCanvas, - rState ) ); + rState ); } } else @@ -2258,7 +2256,7 @@ namespace cppcanvas { // nope if( rParms.maTextTransformation ) - ret = std::shared_ptr( new TextArrayAction( + ret = std::make_shared( aStartPoint, rText, nStartPos, @@ -2266,22 +2264,22 @@ namespace cppcanvas aCharWidths, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); else - ret = std::shared_ptr( new TextArrayAction( + ret = std::make_shared( aStartPoint, rText, nStartPos, nLen, aCharWidths, rCanvas, - rState ) ); + rState ); } else { // at least one of the effects requested if( rParms.maTextTransformation ) - ret = std::shared_ptr( new EffectTextArrayAction( + ret = std::make_shared( aStartPoint, aReliefOffset, rReliefColor, @@ -2295,9 +2293,9 @@ namespace cppcanvas rVDev, rCanvas, rState, - *rParms.maTextTransformation ) ); + *rParms.maTextTransformation ); else - ret = std::shared_ptr( new EffectTextArrayAction( + ret = std::make_shared( aStartPoint, aReliefOffset, rReliefColor, @@ -2310,7 +2308,7 @@ namespace cppcanvas aCharWidths, rVDev, rCanvas, - rState ) ); + rState ); } } return ret; diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index 09e5c200d04d..48be63ed8702 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -465,12 +465,12 @@ namespace cppcanvas const CanvasSharedPtr& rCanvas, const OutDevState& rState ) { - return std::shared_ptr( new TransparencyGroupAction(std::move(rGroupMtf), - std::move(rAlphaGradient), - rDstPoint, - rDstSize, - rCanvas, - rState ) ); + return std::make_shared(std::move(rGroupMtf), + std::move(rAlphaGradient), + rDstPoint, + rDstSize, + rCanvas, + rState ); } } -- cgit v1.2.3