diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-02-03 16:26:38 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-02-03 23:38:37 +0100 |
commit | 6317e10f5b9c347ceb391e049e6d0f3c542f93c4 (patch) | |
tree | 5552a3ccc88bfbdf932735292a008271ab4360fa /canvas | |
parent | a334f77792dfff92e3c97f7f61f59d01fc9338cf (diff) |
loplugin:makeshared (clang-cl)
Change-Id: I0c786bf401e514f9d86e33d8ab6366fc5dd1f425
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/directx/dx_9rm.cxx | 3 | ||||
-rw-r--r-- | canvas/source/directx/dx_bitmap.cxx | 12 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvas.cxx | 12 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvascustomsprite.cxx | 7 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvasfont.cxx | 11 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvashelper_texturefill.cxx | 15 | ||||
-rw-r--r-- | canvas/source/directx/dx_devicehelper.cxx | 12 | ||||
-rw-r--r-- | canvas/source/directx/dx_impltools.cxx | 19 | ||||
-rw-r--r-- | canvas/source/directx/dx_spritedevicehelper.cxx | 17 | ||||
-rw-r--r-- | canvas/source/directx/dx_surfacebitmap.cxx | 14 |
10 files changed, 65 insertions, 57 deletions
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 7f058a2a45bc..511e90e9d6e2 100644 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <sal/log.hxx> +#include <memory> #include <string.h> #include <basegfx/numeric/ftools.hxx> @@ -1205,7 +1206,7 @@ namespace dxcanvas IDXRenderModuleSharedPtr createRenderModule( const vcl::Window& rParent ) { - return IDXRenderModuleSharedPtr( new DXRenderModule(rParent) ); + return std::make_shared<DXRenderModule>(rParent); } } diff --git a/canvas/source/directx/dx_bitmap.cxx b/canvas/source/directx/dx_bitmap.cxx index a9192e05e2dc..524e3a6fdd2d 100644 --- a/canvas/source/directx/dx_bitmap.cxx +++ b/canvas/source/directx/dx_bitmap.cxx @@ -19,6 +19,8 @@ #include <sal/config.h> +#include <memory> + #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2irange.hxx> #include <tools/diagnose_ex.h> @@ -56,19 +58,17 @@ namespace dxcanvas // create container for pixel data if(mbAlpha) { - mpBitmap.reset( - new Gdiplus::Bitmap( + mpBitmap = std::make_shared<Gdiplus::Bitmap>( maSize.getX(), maSize.getY(), - PixelFormat32bppARGB)); + PixelFormat32bppARGB); } else { - mpBitmap.reset( - new Gdiplus::Bitmap( + mpBitmap = std::make_shared<Gdiplus::Bitmap>( maSize.getX(), maSize.getY(), - PixelFormat24bppRGB)); + PixelFormat24bppRGB); } mpGraphics.reset( tools::createGraphicsFromBitmap(mpBitmap) ); diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index 3aace1190f08..39864b14e77d 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -18,6 +18,9 @@ */ #include <sal/config.h> + +#include <memory> + #include <sal/log.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -113,9 +116,8 @@ namespace dxcanvas maDeviceHelper.init( pSysData->hDC, pOutDev, *this ); maCanvasHelper.setDevice( *this ); maCanvasHelper.setTarget( - GraphicsProviderSharedPtr( - new GraphicsProviderImpl( - Gdiplus::Graphics::FromHDC(pSysData->hDC)))); + std::make_shared<GraphicsProviderImpl>( + Gdiplus::Graphics::FromHDC(pSysData->hDC))); maArguments.realloc(0); } @@ -184,11 +186,11 @@ namespace dxcanvas throw lang::NoSupportException( "Passed HDC is no mem DC/has no bitmap selected!"); } - mpTarget.reset( new DXBitmap( + mpTarget = std::make_shared<DXBitmap>( BitmapSharedPtr( Gdiplus::Bitmap::FromHBITMAP( hBmp, nullptr) ), - false )); + false ); maCanvasHelper.setTarget( mpTarget ); diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx b/canvas/source/directx/dx_canvascustomsprite.cxx index ad18d765ae2b..f850342919b5 100644 --- a/canvas/source/directx/dx_canvascustomsprite.cxx +++ b/canvas/source/directx/dx_canvascustomsprite.cxx @@ -19,6 +19,8 @@ #include <sal/config.h> +#include <memory> + #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <cppuhelper/supportsservice.hxx> @@ -46,14 +48,13 @@ namespace dxcanvas ENSURE_OR_THROW( rRefDevice.get(), "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); - mpSurface.reset( - new DXSurfaceBitmap( + mpSurface = std::make_shared<DXSurfaceBitmap>( ::basegfx::B2IVector( ::canvas::tools::roundUp( rSpriteSize.Width ), ::canvas::tools::roundUp( rSpriteSize.Height )), rSurfaceProxy, rRenderModule, - true)); + true); maCanvasHelper.setDevice( *rRefDevice ); maCanvasHelper.setTarget( mpSurface ); diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx index e24553c7ca29..aeb3070525c5 100644 --- a/canvas/source/directx/dx_canvasfont.cxx +++ b/canvas/source/directx/dx_canvasfont.cxx @@ -18,6 +18,9 @@ */ #include <sal/config.h> + +#include <memory> + #include <o3tl/char16_t2wchar_t.hxx> #include <com/sun/star/rendering/PanoseWeight.hpp> @@ -57,14 +60,14 @@ namespace dxcanvas mnEmphasisMark(0), maFontMatrix( fontMatrix ) { - mpFontFamily.reset( new Gdiplus::FontFamily(o3tl::toW(rFontRequest.FontDescription.FamilyName.getStr()),nullptr) ); + mpFontFamily = std::make_shared<Gdiplus::FontFamily>(o3tl::toW(rFontRequest.FontDescription.FamilyName.getStr()),nullptr); if( !mpFontFamily->IsAvailable() ) - mpFontFamily.reset( new Gdiplus::FontFamily(L"Arial",nullptr) ); + mpFontFamily = std::make_shared<Gdiplus::FontFamily>(L"Arial",nullptr); - mpFont.reset( new Gdiplus::Font( mpFontFamily.get(), + mpFont = std::make_shared<Gdiplus::Font>( mpFontFamily.get(), static_cast<Gdiplus::REAL>(rFontRequest.CellSize), calcFontStyle( rFontRequest ), - Gdiplus::UnitWorld )); + Gdiplus::UnitWorld ); ::canvas::tools::extractExtraFontProperties(extraFontProperties, mnEmphasisMark); } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 33a6c018670e..504987c64f9a 100644 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <memory> #include <tuple> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -376,8 +377,8 @@ namespace dxcanvas tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly )); pGradientPath->Transform( &aMatrix ); - pGradientBrush.reset( - new Gdiplus::PathGradientBrush( pGradientPath.get() ) ); + pGradientBrush + = std::make_shared<Gdiplus::PathGradientBrush>( pGradientPath.get() ); pGradientBrush->SetInterpolationColors( rColors.data(), rStops.data(), rStops.size() ); @@ -489,10 +490,9 @@ namespace dxcanvas if( ::rtl::math::approxEqual( rTexture.Alpha, 1.0 ) ) { - pBrush.reset( - new Gdiplus::TextureBrush( + pBrush = std::make_shared<Gdiplus::TextureBrush>( pBitmap.get(), - bClamp ? Gdiplus::WrapModeClamp : Gdiplus::WrapModeTile ) ); + bClamp ? Gdiplus::WrapModeClamp : Gdiplus::WrapModeTile ); } else { @@ -507,11 +507,10 @@ namespace dxcanvas Gdiplus::Rect aRect(0,0, aBmpSize.Width, aBmpSize.Height); - pBrush.reset( - new Gdiplus::TextureBrush( + pBrush = std::make_shared<Gdiplus::TextureBrush>( pBitmap.get(), aRect, - &aImgAttr ) ); + &aImgAttr ); pBrush->SetWrapMode( bClamp ? Gdiplus::WrapModeClamp : Gdiplus::WrapModeTile ); diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx index 767488f75672..1c724bca5513 100644 --- a/canvas/source/directx/dx_devicehelper.cxx +++ b/canvas/source/directx/dx_devicehelper.cxx @@ -19,6 +19,8 @@ #include <sal/config.h> +#include <memory> + #include <basegfx/utils/canvastools.hxx> #include <com/sun/star/lang/NoSupportException.hpp> #include <tools/diagnose_ex.h> @@ -133,10 +135,9 @@ namespace dxcanvas if( !mpDevice ) return uno::Reference< rendering::XBitmap >(); // we're disposed - DXBitmapSharedPtr pBitmap( - new DXBitmap( + DXBitmapSharedPtr pBitmap = std::make_shared<DXBitmap>( ::basegfx::unotools::b2ISizeFromIntegerSize2D(size), - false)); + false); // create a 24bit RGB system memory surface return uno::Reference< rendering::XBitmap >(new CanvasBitmap(pBitmap,mpDevice)); @@ -156,10 +157,9 @@ namespace dxcanvas if( !mpDevice ) return uno::Reference< rendering::XBitmap >(); // we're disposed - DXBitmapSharedPtr pBitmap( - new DXBitmap( + DXBitmapSharedPtr pBitmap = std::make_shared<DXBitmap>( ::basegfx::unotools::b2ISizeFromIntegerSize2D(size), - true)); + true); // create a 32bit ARGB system memory surface return uno::Reference< rendering::XBitmap >(new CanvasBitmap(pBitmap,mpDevice)); diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index 416b46034408..6d7f54e4713b 100644 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <algorithm> +#include <memory> #include <vector> @@ -404,7 +405,7 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points ) { - GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); + GraphicsPathSharedPtr pRes = std::make_shared<Gdiplus::GraphicsPath>(); std::vector< Gdiplus::PointF > aPoints; sal_Int32 nCurrPoly; @@ -432,7 +433,7 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin ) { - GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); + GraphicsPathSharedPtr pRes = std::make_shared<Gdiplus::GraphicsPath>(); std::vector< Gdiplus::PointF > aPoints; graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin ); @@ -442,7 +443,7 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin ) { - GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); + GraphicsPathSharedPtr pRes = std::make_shared<Gdiplus::GraphicsPath>(); std::vector< Gdiplus::PointF > aPoints; const sal_uInt32 nPolies( rPoly.count() ); @@ -495,9 +496,9 @@ namespace dxcanvas bool drawRGBABits( const std::shared_ptr<Gdiplus::Graphics>& rGraphics, const RawRGBABitmap& rRawRGBAData ) { - BitmapSharedPtr pBitmap( new Gdiplus::Bitmap( rRawRGBAData.mnWidth, + BitmapSharedPtr pBitmap = std::make_shared<Gdiplus::Bitmap>( rRawRGBAData.mnWidth, rRawRGBAData.mnHeight, - PixelFormat32bppARGB ) ); + PixelFormat32bppARGB ); Gdiplus::BitmapData aBmpData; aBmpData.Width = rRawRGBAData.mnWidth; @@ -545,9 +546,9 @@ namespace dxcanvas // TODO(P2): At least for the alpha bitmap case, it // would be possible to generate the corresponding // bitmap directly - pBitmap.reset( new Gdiplus::Bitmap( aBmpSize.Width, + pBitmap = std::make_shared<Gdiplus::Bitmap>( aBmpSize.Width, aBmpSize.Height, - PixelFormat32bppARGB ) ); + PixelFormat32bppARGB ); } else { @@ -555,9 +556,9 @@ namespace dxcanvas // to the VCL bitmap. Also, check whether the VCL // bitmap's system handles can be used to create the // GDI+ bitmap (currently, it does not seem so). - pBitmap.reset( new Gdiplus::Bitmap( aBmpSize.Width, + pBitmap = std::make_shared<Gdiplus::Bitmap>( aBmpSize.Width, aBmpSize.Height, - PixelFormat24bppRGB ) ); + PixelFormat24bppRGB ); } GraphicsSharedPtr pGraphics(createGraphicsFromBitmap(pBitmap)); diff --git a/canvas/source/directx/dx_spritedevicehelper.cxx b/canvas/source/directx/dx_spritedevicehelper.cxx index 2147dd9468f1..ee339c8af0ee 100644 --- a/canvas/source/directx/dx_spritedevicehelper.cxx +++ b/canvas/source/directx/dx_spritedevicehelper.cxx @@ -18,6 +18,9 @@ */ #include <sal/config.h> + +#include <memory> + #include <sal/log.hxx> #include <basegfx/utils/canvastools.hxx> @@ -84,11 +87,11 @@ namespace dxcanvas mpSurfaceProxyManager = ::canvas::createSurfaceProxyManager( mpRenderModule ); // #i60490# ensure backbuffer has sensible minimal size - mpBackBuffer.reset(new DXSurfaceBitmap( + mpBackBuffer = std::make_shared<DXSurfaceBitmap>( ::basegfx::B2ISize(w,h), mpSurfaceProxyManager, mpRenderModule, - false)); + false); // Assumes: SystemChildWindow() has CS_OWNDC DeviceHelper::init(GetDC(mpRenderModule->getHWND()),rWindow.GetOutDev(), rSpriteCanvas); @@ -112,12 +115,11 @@ namespace dxcanvas if( !getDevice() ) return uno::Reference< rendering::XBitmap >(); // we're disposed - DXSurfaceBitmapSharedPtr pBitmap( - new DXSurfaceBitmap( + DXSurfaceBitmapSharedPtr pBitmap = std::make_shared<DXSurfaceBitmap>( ::basegfx::unotools::b2ISizeFromIntegerSize2D(size), mpSurfaceProxyManager, mpRenderModule, - false)); + false); // create a 24bit RGB system memory surface return uno::Reference< rendering::XBitmap >(new CanvasBitmap(pBitmap,getDevice())); @@ -137,12 +139,11 @@ namespace dxcanvas if( !getDevice() ) return uno::Reference< rendering::XBitmap >(); // we're disposed - DXSurfaceBitmapSharedPtr pBitmap( - new DXSurfaceBitmap( + DXSurfaceBitmapSharedPtr pBitmap = std::make_shared<DXSurfaceBitmap>( ::basegfx::unotools::b2ISizeFromIntegerSize2D(size), mpSurfaceProxyManager, mpRenderModule, - true)); + true); // create a 32bit ARGB system memory surface return uno::Reference< rendering::XBitmap >(new CanvasBitmap(pBitmap,getDevice())); diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx index 4fcdcba66d1f..7ca1596bcc96 100644 --- a/canvas/source/directx/dx_surfacebitmap.cxx +++ b/canvas/source/directx/dx_surfacebitmap.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <memory> #include <string.h> #include <com/sun/star/rendering/ColorComponentTag.hpp> @@ -222,19 +223,18 @@ namespace dxcanvas // create container for pixel data if(mbAlpha) { - mpGDIPlusBitmap.reset( - new Gdiplus::Bitmap( + mpGDIPlusBitmap = std::make_shared<Gdiplus::Bitmap>( maSize.getX(), maSize.getY(), PixelFormat32bppARGB - )); + ); mpGraphics.reset( tools::createGraphicsFromBitmap(mpGDIPlusBitmap) ); // create the colorbuffer object, which is basically a simple // wrapper around the directx surface. the colorbuffer is the // interface which is used by the surfaceproxy to support any // kind of underlying structure for the pixel data container. - mpColorBuffer.reset(new GDIColorBuffer(mpGDIPlusBitmap,maSize)); + mpColorBuffer = std::make_shared<GDIColorBuffer>(mpGDIPlusBitmap,maSize); } else { @@ -244,7 +244,7 @@ namespace dxcanvas // wrapper around the directx surface. the colorbuffer is the // interface which is used by the surfaceproxy to support any // kind of underlying structure for the pixel data container. - mpColorBuffer.reset(new DXColorBuffer(mpSurface,maSize)); + mpColorBuffer = std::make_shared<DXColorBuffer>(mpSurface,maSize); } // create a (possibly hardware accelerated) mirror surface. @@ -324,10 +324,10 @@ namespace dxcanvas Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB; // construct a gdi+ bitmap from the raw pixel data. - pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(), + pResult = std::make_shared<Gdiplus::Bitmap>( maSize.getX(),maSize.getY(), aLockedRect.Pitch, nFormat, - static_cast<BYTE *>(aLockedRect.pBits) )); + static_cast<BYTE *>(aLockedRect.pBits) ); mpSurface->UnlockRect(); } |