Kaydet (Commit) 30b18e9c authored tarafından Noel Grandin's avatar Noel Grandin

use std::unique_ptr in GDIMetaFile

Change-Id: Id3f223d8d2220fb7d7bb2aaa50bb1a8e29bc0f70
Reviewed-on: https://gerrit.libreoffice.org/47462Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst df1c3938
...@@ -58,9 +58,9 @@ using namespace com::sun::star; ...@@ -58,9 +58,9 @@ using namespace com::sun::star;
struct ImplColAdjustParam struct ImplColAdjustParam
{ {
sal_uInt8* pMapR; std::unique_ptr<sal_uInt8[]> pMapR;
sal_uInt8* pMapG; std::unique_ptr<sal_uInt8[]> pMapG;
sal_uInt8* pMapB; std::unique_ptr<sal_uInt8[]> pMapB;
}; };
struct ImplBmpAdjustParam struct ImplBmpAdjustParam
...@@ -96,14 +96,14 @@ struct ImplBmpMonoParam ...@@ -96,14 +96,14 @@ struct ImplBmpMonoParam
struct ImplColReplaceParam struct ImplColReplaceParam
{ {
sal_uLong* pMinR; std::unique_ptr<sal_uLong[]> pMinR;
sal_uLong* pMaxR; std::unique_ptr<sal_uLong[]> pMaxR;
sal_uLong* pMinG; std::unique_ptr<sal_uLong[]> pMinG;
sal_uLong* pMaxG; std::unique_ptr<sal_uLong[]> pMaxG;
sal_uLong* pMinB; std::unique_ptr<sal_uLong[]> pMinB;
sal_uLong* pMaxB; std::unique_ptr<sal_uLong[]> pMaxB;
const Color* pDstCols; const Color * pDstCols;
sal_uLong nCount; sal_uLong nCount;
}; };
struct ImplBmpReplaceParam struct ImplBmpReplaceParam
...@@ -2103,9 +2103,9 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent, ...@@ -2103,9 +2103,9 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
ImplColAdjustParam aColParam; ImplColAdjustParam aColParam;
ImplBmpAdjustParam aBmpParam; ImplBmpAdjustParam aBmpParam;
aColParam.pMapR = new sal_uInt8[ 256 ]; aColParam.pMapR.reset(new sal_uInt8[ 256 ]);
aColParam.pMapG = new sal_uInt8[ 256 ]; aColParam.pMapG.reset(new sal_uInt8[ 256 ]);
aColParam.pMapB = new sal_uInt8[ 256 ]; aColParam.pMapB.reset(new sal_uInt8[ 256 ]);
// calculate slope // calculate slope
if( nContrastPercent >= 0 ) if( nContrastPercent >= 0 )
...@@ -2168,11 +2168,6 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent, ...@@ -2168,11 +2168,6 @@ void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
// do color adjustment // do color adjustment
ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam ); ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam );
delete[] aColParam.pMapR;
delete[] aColParam.pMapG;
delete[] aColParam.pMapB;
} }
void GDIMetaFile::Convert( MtfConversion eConversion ) void GDIMetaFile::Convert( MtfConversion eConversion )
...@@ -2191,12 +2186,12 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla ...@@ -2191,12 +2186,12 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla
ImplColReplaceParam aColParam; ImplColReplaceParam aColParam;
ImplBmpReplaceParam aBmpParam; ImplBmpReplaceParam aBmpParam;
aColParam.pMinR = new sal_uLong[ nColorCount ]; aColParam.pMinR.reset(new sal_uLong[ nColorCount ]);
aColParam.pMaxR = new sal_uLong[ nColorCount ]; aColParam.pMaxR.reset(new sal_uLong[ nColorCount ]);
aColParam.pMinG = new sal_uLong[ nColorCount ]; aColParam.pMinG.reset(new sal_uLong[ nColorCount ]);
aColParam.pMaxG = new sal_uLong[ nColorCount ]; aColParam.pMaxG.reset(new sal_uLong[ nColorCount ]);
aColParam.pMinB = new sal_uLong[ nColorCount ]; aColParam.pMinB.reset(new sal_uLong[ nColorCount ]);
aColParam.pMaxB = new sal_uLong[ nColorCount ]; aColParam.pMaxB.reset(new sal_uLong[ nColorCount ]);
for( sal_uLong i = 0; i < nColorCount; i++ ) for( sal_uLong i = 0; i < nColorCount; i++ )
{ {
...@@ -2223,13 +2218,6 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla ...@@ -2223,13 +2218,6 @@ void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pRepla
aBmpParam.nCount = nColorCount; aBmpParam.nCount = nColorCount;
ImplExchangeColors( ImplColReplaceFnc, &aColParam, ImplBmpReplaceFnc, &aBmpParam ); 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 GDIMetaFile GDIMetaFile::GetMonochromeMtf( const Color& rColor ) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment