summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-01 19:22:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-02 08:28:05 +0200
commit2bba6d49fefd2f58b1771baee5786e1c49883b5c (patch)
treec33bd572c146a52713f9253fd3e5eae9c315ae88
parenta1ce78b03d37ff845e404aeb224e9cf1092011ce (diff)
loplugin:useuniqueptr in SdrPaintWindow
Change-Id: Ia5a57913b607c0c055a525094ac03c5c3022abb4 Reviewed-on: https://gerrit.libreoffice.org/53713 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svx/sdrpaintwindow.hxx5
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx8
2 files changed, 5 insertions, 8 deletions
diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx
index f36f5c8089a4..92d928da71d2 100644
--- a/include/svx/sdrpaintwindow.hxx
+++ b/include/svx/sdrpaintwindow.hxx
@@ -23,6 +23,7 @@
#include <rtl/ref.hxx>
#include <vcl/virdev.hxx>
#include <svx/svxdllapi.h>
+#include <memory>
class SdrPaintView;
@@ -78,7 +79,7 @@ private:
rtl::Reference< sdr::overlay::OverlayManager > mxOverlayManager;
// The PreRenderDevice for PreRendering
- SdrPreRenderDevice* mpPreRenderDevice;
+ std::unique_ptr<SdrPreRenderDevice> mpPreRenderDevice;
// The RedrawRegion used for rendering
vcl::Region maRedrawRegion;
@@ -123,7 +124,7 @@ public:
void PreparePreRenderDevice();
void DestroyPreRenderDevice();
void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
- SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
+ SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice.get(); }
// RedrawRegion
const vcl::Region& GetRedrawRegion() const { return maRedrawRegion;}
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 1a2c6b3d3dab..e357dd089bb7 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -292,7 +292,7 @@ void SdrPaintWindow::PreparePreRenderDevice()
{
if(!mpPreRenderDevice)
{
- mpPreRenderDevice = new SdrPreRenderDevice(*mpOutputDevice.get());
+ mpPreRenderDevice.reset(new SdrPreRenderDevice(*mpOutputDevice));
}
}
else
@@ -308,11 +308,7 @@ void SdrPaintWindow::PreparePreRenderDevice()
void SdrPaintWindow::DestroyPreRenderDevice()
{
- if(mpPreRenderDevice)
- {
- delete mpPreRenderDevice;
- mpPreRenderDevice = nullptr;
- }
+ mpPreRenderDevice.reset();
}
void SdrPaintWindow::OutputPreRenderDevice(const vcl::Region& rExpandedRegion)