summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-16 09:51:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-17 08:10:28 +0100
commitef3a2e634ca81f5fb292f88c4d7eb28d170ce3dd (patch)
tree890e475df2a7ad05172088688cc200e7f2f5f46e
parent93117d454afc4d7402ae791526e66330f981c4d0 (diff)
loplugin:useuniqueptr in MultiSalLayout
Change-Id: I57ac9cf988dfccfcb38c69ca9c66c2ad77bbdada Reviewed-on: https://gerrit.libreoffice.org/44819 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/inc/sallayout.hxx3
-rw-r--r--vcl/source/gdi/sallayout.cxx10
2 files changed, 6 insertions, 7 deletions
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 04d488d45fff..ff008c44dd55 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -22,6 +22,7 @@
#include <iostream>
#include <list>
+#include <memory>
#include <vector>
#include <basegfx/polygon/b2dpolypolygon.hxx>
@@ -243,7 +244,7 @@ private:
MultiSalLayout& operator=( const MultiSalLayout& ) = delete;
private:
- SalLayout* mpLayouts[ MAX_FALLBACK ];
+ std::unique_ptr<SalLayout> mpLayouts[ MAX_FALLBACK ];
const PhysicalFontFace* mpFallbackFonts[ MAX_FALLBACK ];
ImplLayoutRuns maFallbackRuns[ MAX_FALLBACK ];
int mnLevel;
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 6184d18e2ca9..b8957ae14eb3 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1031,7 +1031,7 @@ MultiSalLayout::MultiSalLayout( std::unique_ptr<SalLayout> pBaseLayout )
{
//maFallbackRuns[0].Clear();
mpFallbackFonts[ 0 ] = nullptr;
- mpLayouts[ 0 ] = pBaseLayout.release();
+ mpLayouts[ 0 ] = std::move(pBaseLayout);
mnUnitsPerPixel = mpLayouts[ 0 ]->GetUnitsPerPixel();
}
@@ -1043,8 +1043,6 @@ void MultiSalLayout::SetIncomplete(bool bIncomplete)
MultiSalLayout::~MultiSalLayout()
{
- for( int i = 0; i < mnLevel; ++i )
- delete mpLayouts[ i ];
}
void MultiSalLayout::AddFallback( std::unique_ptr<SalLayout> pFallback,
@@ -1054,7 +1052,7 @@ void MultiSalLayout::AddFallback( std::unique_ptr<SalLayout> pFallback,
return;
mpFallbackFonts[ mnLevel ] = pFallbackFont;
- mpLayouts[ mnLevel ] = pFallback.release();
+ mpLayouts[ mnLevel ] = std::move(pFallback);
maFallbackRuns[ mnLevel-1 ] = rFallbackRuns;
++mnLevel;
}
@@ -1187,14 +1185,14 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
if( (n > 0) && !nValid[ nLevel ] )
{
// an empty fallback layout can be released
- delete mpLayouts[n];
+ mpLayouts[n].reset();
}
else
{
// reshuffle used fallbacks if needed
if( nLevel != n )
{
- mpLayouts[ nLevel ] = mpLayouts[ n ];
+ mpLayouts[ nLevel ] = std::move(mpLayouts[ n ]);
mpFallbackFonts[ nLevel ] = mpFallbackFonts[ n ];
maFallbackRuns[ nLevel ] = maFallbackRuns[ n ];
}