summaryrefslogtreecommitdiff
path: root/vcl/quartz
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-09-15 21:14:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-19 10:09:33 +0200
commitd469dca492e55798251c7f570bb730a38c32e893 (patch)
tree808c559f6dc8f7887dfd27eef318607e2df5f6ba /vcl/quartz
parent21614aadc2b7a7bb6d2e00a5a081d8d233e4384b (diff)
loplugin:useuniqueptr in GetTTSimpleGlyphMetrics
and only return the advance, we don't use the other field Change-Id: I956033dac97763caea2b27404fe9f099da809899 Reviewed-on: https://gerrit.libreoffice.org/60703 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/quartz')
-rw-r--r--vcl/quartz/salgdi.cxx6
-rw-r--r--vcl/quartz/salgdicommon.cxx12
2 files changed, 9 insertions, 9 deletions
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index db595a5aa37b..43ca506220c9 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -756,15 +756,15 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
aGlyphIds[i] = static_cast<sal_uInt16>(i);
}
- const TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, &aGlyphIds[0],
+ std::unique_ptr<sal_uInt16[]> pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, &aGlyphIds[0],
nGlyphCount, bVertical );
if( pGlyphMetrics )
{
for( int i = 0; i < nGlyphCount; ++i )
{
- rGlyphWidths[i] = pGlyphMetrics[i].adv;
+ rGlyphWidths[i] = pGlyphMetrics[i];
}
- free( const_cast<TTSimpleGlyphMetrics *>(pGlyphMetrics) );
+ pGlyphMetrics.reset();
}
rtl::Reference<CoreTextFontFace> rCTFontData(new CoreTextFontFace(*pFontData, pFontData->GetFontId()));
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 59d836506b52..2d952244847e 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -302,21 +302,21 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
// fill the pGlyphWidths array
// while making sure that the NotDef glyph is at index==0
- TTSimpleGlyphMetrics* pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs,
+ std::unique_ptr<sal_uInt16[]> pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aShortIDs,
nGlyphCount, bVertical );
if( !pGlyphMetrics )
{
return false;
}
- sal_uInt16 nNotDefAdv = pGlyphMetrics[0].adv;
- pGlyphMetrics[0].adv = pGlyphMetrics[nNotDef].adv;
- pGlyphMetrics[nNotDef].adv = nNotDefAdv;
+ sal_uInt16 nNotDefAdv = pGlyphMetrics[0];
+ pGlyphMetrics[0] = pGlyphMetrics[nNotDef];
+ pGlyphMetrics[nNotDef] = nNotDefAdv;
for( int i = 0; i < nOrigCount; ++i )
{
- pGlyphWidths[i] = pGlyphMetrics[i].adv;
+ pGlyphWidths[i] = pGlyphMetrics[i];
}
- free( pGlyphMetrics );
+ pGlyphMetrics.reset();
// write subset into destination file
nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs,