summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/impvect.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-23 12:21:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-24 13:16:47 +0100
commit797ae3d3431ac497d71676f6124010777377e794 (patch)
treed233116d29059bc0f72349e48bcb4278a64c7c46 /vcl/source/gdi/impvect.cxx
parent1dcc7efc6f60084c80c4d7b0a5caf42c23f3be99 (diff)
Make ImplColorSet default ctor zero-initialize all members
...allowing to simplify creating the pColorSet array (which might want to be improved even further, turning it into a unique_ptr or vector) Change-Id: Ic05bd987057a0844885ccfc6ca52700770a27282 Reviewed-on: https://gerrit.libreoffice.org/48401 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source/gdi/impvect.cxx')
-rw-r--r--vcl/source/gdi/impvect.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index 841f1895a970..b94886a841b1 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -95,8 +95,8 @@ static const ChainMove aImplMoveOuter[ 8 ] = {
struct ImplColorSet
{
BitmapColor maColor;
- sal_uInt16 mnIndex;
- bool mbSet;
+ sal_uInt16 mnIndex = 0;
+ bool mbSet = false;
};
extern "C" int ImplColorSetCmpFnc( const void* p1, const void* p2 )
@@ -644,9 +644,8 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
const long nHeight = pRAcc->Height();
const sal_uInt16 nColorCount = pRAcc->GetPaletteEntryCount();
sal_uInt16 n;
- ImplColorSet* pColorSet = reinterpret_cast<ImplColorSet*>(new sal_uInt8[ 256 * sizeof( ImplColorSet ) ]);
+ ImplColorSet* pColorSet = new ImplColorSet[ 256 ];
- memset( pColorSet, 0, 256 * sizeof( ImplColorSet ) );
rMtf.Clear();
// get used palette colors and sort them from light to dark colors
@@ -703,7 +702,7 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) );
}
- delete[] reinterpret_cast<sal_uInt8*>(pColorSet);
+ delete[] pColorSet;
if( rMtf.GetActionSize() )
{