summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-15 09:46:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-16 11:46:03 +0200
commit9b22966b2ce43b81cd156777dc6b5673582d15f1 (patch)
tree5602c74913c590497b9d0521bcc6de2ce3285471
parent57ca1aa405845077af8ff6955236e6fc88758a99 (diff)
loplugin:useuniqueptr in OutDevStatefeature/foo
Change-Id: I9e29ca57eb3f00987dbac74cf7da2222f5b6d869
-rw-r--r--include/vcl/outdevstate.hxx21
-rw-r--r--vcl/source/outdev/outdevstate.cxx42
2 files changed, 32 insertions, 31 deletions
diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 94cf877e03d0..d58faac00c52 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -29,6 +29,7 @@
#include <tools/gen.hxx>
#include <tools/fontenum.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <memory>
class Color;
@@ -79,17 +80,17 @@ public:
OutDevState();
~OutDevState();
- MapMode* mpMapMode;
+ std::unique_ptr<MapMode> mpMapMode;
bool mbMapActive;
- vcl::Region* mpClipRegion;
- Color* mpLineColor;
- Color* mpFillColor;
- vcl::Font* mpFont;
- Color* mpTextColor;
- Color* mpTextFillColor;
- Color* mpTextLineColor;
- Color* mpOverlineColor;
- Point* mpRefPoint;
+ std::unique_ptr<vcl::Region> mpClipRegion;
+ std::unique_ptr<Color> mpLineColor;
+ std::unique_ptr<Color> mpFillColor;
+ std::unique_ptr<vcl::Font> mpFont;
+ std::unique_ptr<Color> mpTextColor;
+ std::unique_ptr<Color> mpTextFillColor;
+ std::unique_ptr<Color> mpTextLineColor;
+ std::unique_ptr<Color> mpOverlineColor;
+ std::unique_ptr<Point> mpRefPoint;
TextAlign meTextAlign;
RasterOp meRasterOp;
ComplexTextLayoutFlags mnTextLayoutMode;
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 388962906829..07b7d1cfa85e 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -52,16 +52,16 @@ OutDevState::OutDevState()
OutDevState::~OutDevState()
{
- delete mpLineColor;
- delete mpFillColor;
- delete mpFont;
- delete mpTextColor;
- delete mpTextFillColor;
- delete mpTextLineColor;
- delete mpOverlineColor;
- delete mpMapMode;
- delete mpClipRegion;
- delete mpRefPoint;
+ mpLineColor.reset();
+ mpFillColor.reset();
+ mpFont.reset();
+ mpTextColor.reset();
+ mpTextFillColor.reset();
+ mpTextLineColor.reset();
+ mpOverlineColor.reset();
+ mpMapMode.reset();
+ mpClipRegion.reset();
+ mpRefPoint.reset();
}
void OutputDevice::Push( PushFlags nFlags )
@@ -76,27 +76,27 @@ void OutputDevice::Push( PushFlags nFlags )
if (nFlags & PushFlags::LINECOLOR && mbLineColor)
{
- pState->mpLineColor = new Color( maLineColor );
+ pState->mpLineColor.reset( new Color( maLineColor ) );
}
if (nFlags & PushFlags::FILLCOLOR && mbFillColor)
{
- pState->mpFillColor = new Color( maFillColor );
+ pState->mpFillColor.reset( new Color( maFillColor ) );
}
if ( nFlags & PushFlags::FONT )
- pState->mpFont = new vcl::Font( maFont );
+ pState->mpFont.reset( new vcl::Font( maFont ) );
if ( nFlags & PushFlags::TEXTCOLOR )
- pState->mpTextColor = new Color( GetTextColor() );
+ pState->mpTextColor.reset( new Color( GetTextColor() ) );
if (nFlags & PushFlags::TEXTFILLCOLOR && IsTextFillColor())
{
- pState->mpTextFillColor = new Color( GetTextFillColor() );
+ pState->mpTextFillColor.reset( new Color( GetTextFillColor() ) );
}
if (nFlags & PushFlags::TEXTLINECOLOR && IsTextLineColor())
{
- pState->mpTextLineColor = new Color( GetTextLineColor() );
+ pState->mpTextLineColor.reset( new Color( GetTextLineColor() ) );
}
if (nFlags & PushFlags::OVERLINECOLOR && IsOverlineColor())
{
- pState->mpOverlineColor = new Color( GetOverlineColor() );
+ pState->mpOverlineColor.reset( new Color( GetOverlineColor() ) );
}
if ( nFlags & PushFlags::TEXTALIGN )
pState->meTextAlign = GetTextAlign();
@@ -108,16 +108,16 @@ void OutputDevice::Push( PushFlags nFlags )
pState->meRasterOp = GetRasterOp();
if ( nFlags & PushFlags::MAPMODE )
{
- pState->mpMapMode = new MapMode( maMapMode );
+ pState->mpMapMode.reset( new MapMode( maMapMode ) );
pState->mbMapActive = mbMap;
}
if (nFlags & PushFlags::CLIPREGION && mbClipRegion)
{
- pState->mpClipRegion = new vcl::Region( maRegion );
+ pState->mpClipRegion.reset( new vcl::Region( maRegion ) );
}
if (nFlags & PushFlags::REFPOINT && mbRefPoint)
{
- pState->mpRefPoint = new Point( maRefPoint );
+ pState->mpRefPoint.reset( new Point( maRefPoint ) );
}
mpOutDevStateStack->push_back( pState );
@@ -213,7 +213,7 @@ void OutputDevice::Pop()
}
if ( rState.mnFlags & PushFlags::CLIPREGION )
- SetDeviceClipRegion( rState.mpClipRegion );
+ SetDeviceClipRegion( rState.mpClipRegion.get() );
if ( rState.mnFlags & PushFlags::REFPOINT )
{