diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-04 12:12:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-05 09:29:42 +0200 |
commit | 3b4ffee640b9f3f19d142de518ebc85378e68e9c (patch) | |
tree | f850ce5e1d381dd5d4c2aa24429d3aeabec453bc /vcl | |
parent | 93e5da84a40be70857833903e3ebdea395c06596 (diff) |
loplugin:useuniqueptr in Window
Change-Id: I0072d3085b1c00573d72948d1bbefb241b0da205
Reviewed-on: https://gerrit.libreoffice.org/59998
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/clipping.cxx | 26 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 15 |
2 files changed, 18 insertions, 23 deletions
diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index b7c6fbf36cb5..8ad91cedb45f 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -403,9 +403,9 @@ bool Window::ImplSetClipFlagChildren( bool bSysObjOnlySmaller ) bool bUpdate = true; if ( mpWindowImpl->mpSysObj ) { - vcl::Region* pOldRegion = nullptr; + std::unique_ptr<vcl::Region> pOldRegion; if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion ) - pOldRegion = new vcl::Region( mpWindowImpl->maWinClipRegion ); + pOldRegion.reset(new vcl::Region( mpWindowImpl->maWinClipRegion )); mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; @@ -418,27 +418,25 @@ bool Window::ImplSetClipFlagChildren( bool bSysObjOnlySmaller ) pWindow = pWindow->mpWindowImpl->mpNext; } - if ( !ImplSysObjClip( pOldRegion ) ) + if ( !ImplSysObjClip( pOldRegion.get() ) ) { mbInitClipRegion = true; mpWindowImpl->mbInitWinClipRegion = true; bUpdate = false; } - - delete pOldRegion; } else { - mbInitClipRegion = true; - mpWindowImpl->mbInitWinClipRegion = true; + mbInitClipRegion = true; + mpWindowImpl->mbInitWinClipRegion = true; - vcl::Window* pWindow = mpWindowImpl->mpFirstChild; - while ( pWindow ) - { - if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) ) - bUpdate = false; - pWindow = pWindow->mpWindowImpl->mpNext; - } + vcl::Window* pWindow = mpWindowImpl->mpFirstChild; + while ( pWindow ) + { + if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) ) + bUpdate = false; + pWindow = pWindow->mpWindowImpl->mpNext; + } } return bUpdate; } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 243d30a93beb..c6d2fea5c614 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1440,14 +1440,14 @@ void Window::ImplPosSizeWindow( long nX, long nY, long nOldOutOffY = mnOutOffY; long nOldOutWidth = mnOutWidth; long nOldOutHeight = mnOutHeight; - vcl::Region* pOverlapRegion = nullptr; - vcl::Region* pOldRegion = nullptr; + std::unique_ptr<vcl::Region> pOverlapRegion; + std::unique_ptr<vcl::Region> pOldRegion; if ( IsReallyVisible() ) { tools::Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ), Size( nOldOutWidth, nOldOutHeight ) ); - pOldRegion = new vcl::Region( aOldWinRect ); + pOldRegion.reset( new vcl::Region( aOldWinRect ) ); if ( mpWindowImpl->mbWinRegion ) pOldRegion->Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) ); @@ -1527,7 +1527,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, { if ( bCopyBits && !pOverlapRegion ) { - pOverlapRegion = new vcl::Region(); + pOverlapRegion.reset( new vcl::Region() ); ImplCalcOverlapRegion( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ), *pOverlapRegion, false, true ); @@ -1545,7 +1545,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, { if ( bCopyBits && !pOverlapRegion ) { - pOverlapRegion = new vcl::Region(); + pOverlapRegion.reset( new vcl::Region() ); ImplCalcOverlapRegion( tools::Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ), *pOverlapRegion, false, true ); @@ -1670,7 +1670,7 @@ void Window::ImplPosSizeWindow( long nX, long nY, if ( !bInvalidate ) { if ( !pOverlapRegion->IsEmpty() ) - ImplInvalidateFrameRegion( pOverlapRegion, InvalidateFlags::Children ); + ImplInvalidateFrameRegion( pOverlapRegion.get(), InvalidateFlags::Children ); } } else @@ -1716,9 +1716,6 @@ void Window::ImplPosSizeWindow( long nX, long nY, if ( bNewSize && mpWindowImpl->mpSysObj ) mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); } - - delete pOverlapRegion; - delete pOldRegion; } void Window::ImplNewInputContext() |