diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-11-27 15:04:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-11-27 23:36:55 +0100 |
commit | 401a3d2336bf46b38235c498ff86ff675d0de759 (patch) | |
tree | 38f85993647e4aea76f435949a17864ef984ed30 /vcl | |
parent | e75c983acfe0c496106ab1ef2a566408b8955cb8 (diff) |
loplugin:useuniqueptr (clang-cl)
Change-Id: Id9020bef2ce0fa9a7a70f48d27fb57735c6f57ca
Reviewed-on: https://gerrit.libreoffice.org/45340
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/win/salvd.h | 10 | ||||
-rw-r--r-- | vcl/win/gdi/salvd.cxx | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h index 1e40ed706324..f4825836036e 100644 --- a/vcl/inc/win/salvd.h +++ b/vcl/inc/win/salvd.h @@ -20,6 +20,10 @@ #ifndef INCLUDED_VCL_INC_WIN_SALVD_H #define INCLUDED_VCL_INC_WIN_SALVD_H +#include <sal/config.h> + +#include <memory> + #include <salvd.hxx> class WinSalGraphics; @@ -31,7 +35,7 @@ private: HDC mhLocalDC; // HDC or 0 for Cache Device HBITMAP mhBmp; // Memory Bitmap HBITMAP mhDefBmp; // Default Bitmap - WinSalGraphics* mpGraphics; // current VirDev graphics + std::unique_ptr<WinSalGraphics> mpGraphics; // current VirDev graphics WinSalVirtualDevice* mpNext; // next VirDev sal_uInt16 mnBitCount; // BitCount (0 or 1) bool mbGraphics; // is Graphics used @@ -41,8 +45,8 @@ private: public: HDC getHDC() const { return mhLocalDC; } - WinSalGraphics* getGraphics() const { return mpGraphics; } - void setGraphics(WinSalGraphics* pVirGraphics) { mpGraphics = pVirGraphics; } + WinSalGraphics* getGraphics() const { return mpGraphics.get(); } + void setGraphics(WinSalGraphics* pVirGraphics) { mpGraphics.reset(pVirGraphics); } WinSalVirtualDevice* getNext() const { return mpNext; } WinSalVirtualDevice(HDC hDC = nullptr, HBITMAP hBMP = nullptr, sal_uInt16 nBitCount = 0, bool bForeignDC = false, long nWidth = 0, long nHeight = 0); diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx index 615bf3ee2207..17b32862d52f 100644 --- a/vcl/win/gdi/salvd.cxx +++ b/vcl/win/gdi/salvd.cxx @@ -148,7 +148,6 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, WinSalVirtualDevice::WinSalVirtualDevice(HDC hDC, HBITMAP hBMP, sal_uInt16 nBitCount, bool bForeignDC, long nWidth, long nHeight) : mhLocalDC(hDC), // HDC or 0 for Cache Device mhBmp(hBMP), // Memory Bitmap - mpGraphics(nullptr), // current VirDev graphics mnBitCount(nBitCount), // BitCount (0 or 1) mbGraphics(false), // is Graphics used mbForeignDC(bForeignDC), // uses a foreign DC instead of a bitmap @@ -186,8 +185,7 @@ WinSalVirtualDevice::~WinSalVirtualDevice() DeleteDC( mpGraphics->getHDC() ); if( mhBmp ) DeleteBitmap( mhBmp ); - delete mpGraphics; - mpGraphics = nullptr; + mpGraphics.reset(); } SalGraphics* WinSalVirtualDevice::AcquireGraphics() @@ -198,7 +196,7 @@ SalGraphics* WinSalVirtualDevice::AcquireGraphics() if ( mpGraphics ) mbGraphics = true; - return mpGraphics; + return mpGraphics.get(); } void WinSalVirtualDevice::ReleaseGraphics( SalGraphics* ) |