summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-05 11:32:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-06 07:36:19 +0100
commit30b18e9c1ce5578ce22cb75e38f489eb25c4b7c7 (patch)
tree5bd2f63402b4e155da34ca7d1e8a724ad607aab8 /vcl
parentdf1c3938d2c54fbf72a0e58a9f178557fca48a3b (diff)
use std::unique_ptr in GDIMetaFile
Change-Id: Id3f223d8d2220fb7d7bb2aaa50bb1a8e29bc0f70 Reviewed-on: https://gerrit.libreoffice.org/47462 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/gdimtf.cxx52
1 files changed, 20 insertions, 32 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 05135718af64..f4e5a8c187fb 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -58,9 +58,9 @@ using namespace com::sun::star;
struct ImplColAdjustParam
{
- sal_uInt8* pMapR;
- sal_uInt8* pMapG;
- sal_uInt8* pMapB;
+ std::unique_ptr<sal_uInt8[]> pMapR;
+ std::unique_ptr<sal_uInt8[]> pMapG;
+ std::unique_ptr<sal_uInt8[]> pMapB;
};
struct ImplBmpAdjustParam
@@ -96,14 +96,14 @@ struct ImplBmpMonoParam
struct ImplColReplaceParam
{
- sal_uLong* pMinR;
- sal_uLong* pMaxR;
- sal_uLong* pMinG;
- sal_uLong* pMaxG;
- sal_uLong* pMinB;
- sal_uLong* pMaxB;
- const Color* pDstCols;
- sal_uLong nCount;
+ std::unique_ptr<sal_uLong[]> pMinR;
+ std::unique_ptr<sal_uLong[]> pMaxR;
+ std::unique_ptr<sal_uLong[]> pMinG;
+ std::unique_ptr<sal_uLong[]> pMaxG;
+ std::unique_ptr<sal_uLong[]> pMinB;
+ std::unique_ptr<sal_uLong[]> pMaxB;
+ const Color * pDstCols;
+ sal_uLong nCount;
};
struct ImplBmpReplaceParam
@@ -2103,9 +2103,9 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
ImplColAdjustParam aColParam;
ImplBmpAdjustParam aBmpParam;
- aColParam.pMapR = new sal_uInt8[ 256 ];
- aColParam.pMapG = new sal_uInt8[ 256 ];
- aColParam.pMapB = new sal_uInt8[ 256 ];
+ aColParam.pMapR.reset(new sal_uInt8[ 256 ]);
+ aColParam.pMapG.reset(new sal_uInt8[ 256 ]);
+ aColParam.pMapB.reset(new sal_uInt8[ 256 ]);
// calculate slope
if( nContrastPercent >= 0 )
@@ -2168,11 +2168,6 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
// do color adjustment
ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam );
-
- delete[] aColParam.pMapR;
- delete[] aColParam.pMapG;
- delete[] aColParam.pMapB;
-
}
void GDIMetaFile::Convert( MtfConversion eConversion )
@@ -2191,12 +2186,12 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla
ImplColReplaceParam aColParam;
ImplBmpReplaceParam aBmpParam;
- aColParam.pMinR = new sal_uLong[ nColorCount ];
- aColParam.pMaxR = new sal_uLong[ nColorCount ];
- aColParam.pMinG = new sal_uLong[ nColorCount ];
- aColParam.pMaxG = new sal_uLong[ nColorCount ];
- aColParam.pMinB = new sal_uLong[ nColorCount ];
- aColParam.pMaxB = new sal_uLong[ nColorCount ];
+ aColParam.pMinR.reset(new sal_uLong[ nColorCount ]);
+ aColParam.pMaxR.reset(new sal_uLong[ nColorCount ]);
+ aColParam.pMinG.reset(new sal_uLong[ nColorCount ]);
+ aColParam.pMaxG.reset(new sal_uLong[ nColorCount ]);
+ aColParam.pMinB.reset(new sal_uLong[ nColorCount ]);
+ aColParam.pMaxB.reset(new sal_uLong[ nColorCount ]);
for( sal_uLong i = 0; i < nColorCount; i++ )
{
@@ -2223,13 +2218,6 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla
aBmpParam.nCount = nColorCount;
ImplExchangeColors( ImplColReplaceFnc, &aColParam, ImplBmpReplaceFnc, &aBmpParam );
-
- delete[] aColParam.pMinR;
- delete[] aColParam.pMaxR;
- delete[] aColParam.pMinG;
- delete[] aColParam.pMaxG;
- delete[] aColParam.pMinB;
- delete[] aColParam.pMaxB;
};
GDIMetaFile GDIMetaFile::GetMonochromeMtf( const Color& rColor ) const