diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-09-15 21:14:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-19 10:09:33 +0200 |
commit | d469dca492e55798251c7f570bb730a38c32e893 (patch) | |
tree | 808c559f6dc8f7887dfd27eef318607e2df5f6ba /vcl/win | |
parent | 21614aadc2b7a7bb6d2e00a5a081d8d233e4384b (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/win')
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index fdffffecd037..d49040201cd7 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1737,16 +1737,16 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, SAL_WARN_IF( nGlyphCount >= 257, "vcl", "too many glyphs for subsetting" ); // fill pWidth array - TTSimpleGlyphMetrics* pMetrics = + std::unique_ptr<sal_uInt16[]> pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(), aShortIDs, nGlyphCount, aIFSD.mbVertical ); if( !pMetrics ) return FALSE; - sal_uInt16 nNotDefAdv = pMetrics[0].adv; - pMetrics[0].adv = pMetrics[nNotDef].adv; - pMetrics[nNotDef].adv = nNotDefAdv; + sal_uInt16 nNotDefAdv = pMetrics[0]; + pMetrics[0] = pMetrics[nNotDef]; + pMetrics[nNotDef] = nNotDefAdv; for( i = 0; i < nOrigCount; ++i ) - pGlyphWidths[i] = pMetrics[i].adv; - free( pMetrics ); + pGlyphWidths[i] = pMetrics[i]; + pMetrics.reset(); // write subset into destination file nRC = ::CreateTTFromTTGlyphs( aSftTTF.get(), aToFile.getStr(), aShortIDs, @@ -1819,15 +1819,15 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, std::vector<sal_uInt16> aGlyphIds(nGlyphs); for( int i = 0; i < nGlyphs; i++ ) aGlyphIds[i] = sal_uInt16(i); - TTSimpleGlyphMetrics* pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(), + std::unique_ptr<sal_uInt16[]> pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(), &aGlyphIds[0], nGlyphs, bVertical ); if( pMetrics ) { for( int i = 0; i< nGlyphs; i++ ) - rWidths[i] = pMetrics[i].adv; - free( pMetrics ); + rWidths[i] = pMetrics[i]; + pMetrics.reset(); rUnicodeEnc.clear(); } const WinFontFace* pWinFont = static_cast<const WinFontFace*>(pFont); |