[Libreoffice-commits] core.git: 2 commits - vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Sep 5 07:29:52 UTC 2018
vcl/source/gdi/print.cxx | 7 ++-----
vcl/source/window/clipping.cxx | 26 ++++++++++++--------------
vcl/source/window/window.cxx | 15 ++++++---------
3 files changed, 20 insertions(+), 28 deletions(-)
New commits:
commit 3b4ffee640b9f3f19d142de518ebc85378e68e9c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 4 12:12:48 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 5 09:29:42 2018 +0200
loplugin:useuniqueptr in Window
Change-Id: I0072d3085b1c00573d72948d1bbefb241b0da205
Reviewed-on: https://gerrit.libreoffice.org/59998
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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()
commit 93e5da84a40be70857833903e3ebdea395c06596
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 4 12:12:22 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 5 09:29:28 2018 +0200
loplugin:useuniqueptr in Printer
Change-Id: I5326c96f86f6805246837524e75504c1c5db99b5
Reviewed-on: https://gerrit.libreoffice.org/59997
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index c767a0a65c02..8d876acaa38f 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -743,8 +743,8 @@ void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
// do painting
const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
long nX, nY; //, nWorkX, nWorkY, nWorkWidth, nWorkHeight;
- long* pMapX = new long[ nSrcWidth + 1 ];
- long* pMapY = new long[ nSrcHeight + 1 ];
+ std::unique_ptr<long[]> pMapX( new long[ nSrcWidth + 1 ] );
+ std::unique_ptr<long[]> pMapY( new long[ nSrcHeight + 1 ] );
GDIMetaFile* pOldMetaFile = mpMetaFile;
const bool bOldMap = mbMap;
@@ -779,11 +779,8 @@ void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
}
Pop();
- delete[] pMapX;
- delete[] pMapY;
mbMap = bOldMap;
mpMetaFile = pOldMetaFile;
-
}
SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
More information about the Libreoffice-commits
mailing list