vcl/generic/fontmanager/fontcache.cxx | 1 vcl/generic/fontmanager/fontmanager.cxx | 33 +++++++++++++++----------------- vcl/inc/vcl/fontmanager.hxx | 2 - vcl/source/gdi/bitmapex.cxx | 4 ++- 4 files changed, 21 insertions(+), 19 deletions(-)
New commits: commit c1d8a95a04bd8df8dfed916d40fdda75d6858816 Author: Michael Meeks <[email protected]> Date: Fri Feb 22 19:25:43 2013 +0000 re-factor AFM metric reading to simplify signatures. Change-Id: I77433ff3926b6f8e2968b30451acf8acbbb4deb3 diff --git a/vcl/generic/fontmanager/fontcache.cxx b/vcl/generic/fontmanager/fontcache.cxx index ea5cc35..863ee70 100644 --- a/vcl/generic/fontmanager/fontcache.cxx +++ b/vcl/generic/fontmanager/fontcache.cxx @@ -729,6 +729,7 @@ bool FontCache::listDirectory( const OString& rDir, std::list< PrintFontManager: { PrintFontManager& rManager( PrintFontManager::get() ); int nDirID = rManager.getDirectoryAtom( rDir ); + FontCacheData::const_iterator dir = m_aCache.find( nDirID ); bool bFound = (dir != m_aCache.end()); diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index b571955..175b000 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <unistd.h> #include <sys/stat.h> #include <dirent.h> @@ -223,14 +222,14 @@ PrintFontManager::BuiltinFont::~BuiltinFont() bool PrintFontManager::Type1FontFile::queryMetricPage( int /*nPage*/, MultiAtomProvider* pProvider ) { - return readAfmMetrics( PrintFontManager::get().getAfmFile( this ), pProvider, false, false ); + return readAfmMetrics( pProvider, false, false ); } // ------------------------------------------------------------------------- bool PrintFontManager::BuiltinFont::queryMetricPage( int /*nPage*/, MultiAtomProvider* pProvider ) { - return readAfmMetrics( PrintFontManager::get().getAfmFile( this ), pProvider, false, false ); + return readAfmMetrics( pProvider, false, false ); } // ------------------------------------------------------------------------- @@ -557,9 +556,10 @@ static bool familyNameOverride( const OUString& i_rPSname, OUString& o_rFamilyNa return bReplaced; }; -bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ) +bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ) { PrintFontManager& rManager( PrintFontManager::get() ); + const OString& rFileName = rManager.getAfmFile( this ); FontInfo* pInfo = NULL; parseFile( rFileName.getStr(), &pInfo, P_ALL ); @@ -1154,7 +1154,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, :: pFont->m_aFontFile = rFontFile; pFont->m_aMetricFile = aAfmFile; - if( ! pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, true ) ) + if( ! pFont->readAfmMetrics( m_pAtoms, false, true ) ) { delete pFont; pFont = NULL; @@ -1167,13 +1167,10 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, :: } else if (eFormat == AFM) { - rtl::OStringBuffer aFilePath(aDir); - aFilePath.append('/').append(rFontFile); BuiltinFont* pFont = new BuiltinFont(); pFont->m_nDirectory = nDirID; pFont->m_aMetricFile = rFontFile; - if( pFont->readAfmMetrics( aFilePath.makeStringAndClear(), m_pAtoms, - false, true ) ) + if( pFont->readAfmMetrics( m_pAtoms, false, true ) ) { rNewFonts.push_back( pFont ); } @@ -1757,6 +1754,8 @@ void PrintFontManager::initialize() else if( (*it)->m_eType == fonttype::Builtin ) m_aFontFileToFontID[ static_cast<BuiltinFont*>(*it)->m_aMetricFile ].insert( aFont ); #if OSL_DEBUG_LEVEL > 1 + else + fprintf(stderr, "Un-cached type '%d'\n", (*it)->m_eType); if( (*it)->m_eType == fonttype::Builtin ) nBuiltinFonts++; nCached++; @@ -2119,7 +2118,7 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo { // might be a truetype font not analyzed or type1 without metrics read if( pFont->m_eType == fonttype::Type1 ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, false ); + pFont->readAfmMetrics( m_pAtoms, false, false ); else if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -2188,7 +2187,7 @@ bool PrintFontManager::getFontBoundingBox( fontID nFontID, int& xMin, int& yMin, { // might be a truetype font not analyzed or type1 without metrics read if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, true ); + pFont->readAfmMetrics( m_pAtoms, false, true ); else if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -2363,7 +2362,7 @@ int PrintFontManager::getFontAscend( fontID nFontID ) const if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); else if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, true ); + pFont->readAfmMetrics( m_pAtoms, false, true ); } return pFont->m_nAscend; } @@ -2379,7 +2378,7 @@ int PrintFontManager::getFontDescend( fontID nFontID ) const if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); else if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, true ); + pFont->readAfmMetrics( m_pAtoms, false, true ); } return pFont->m_nDescend; } @@ -2482,7 +2481,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i { // might be a font not yet analyzed if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, false ); + pFont->readAfmMetrics( m_pAtoms, false, false ); else if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -2529,7 +2528,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal { // might be a font not yet analyzed if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, false, false ); + pFont->readAfmMetrics( m_pAtoms, false, false ); else if( pFont->m_eType == fonttype::TrueType ) analyzeTrueTypeFile( pFont ); } @@ -2773,7 +2772,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont, else if( pFont->m_eType == fonttype::Type1 ) { if( ! pFont->m_aEncodingVector.size() ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, true, true ); + pFont->readAfmMetrics( m_pAtoms, true, true ); if( pFont->m_pMetrics ) { rUnicodeEnc.clear(); @@ -2804,7 +2803,7 @@ const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( font return NULL; if( ! pFont->m_aEncodingVector.size() ) - pFont->readAfmMetrics( getAfmFile( pFont ), m_pAtoms, true, true ); + pFont->readAfmMetrics( m_pAtoms, true, true ); if( pNonEncoded ) *pNonEncoded = pFont->m_aNonEncoded.size() ? &pFont->m_aNonEncoded : NULL; diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index 08aa6db..ea2473f 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -220,7 +220,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager virtual ~PrintFont(); virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ) = 0; - bool readAfmMetrics( const rtl::OString& rFileName, utl::MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ); + bool readAfmMetrics( utl::MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes ); }; struct Type1FontFile : public PrintFont commit cb8fcf5a169f030827b1150c50b6ed284717e485 Author: Michael Meeks <[email protected]> Date: Fri Feb 22 16:53:39 2013 +0000 perf: avoid scaling images to the same size at some cost. Change-Id: Icae65a8bf48f76801c536607055be066be0bd49f diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index e7a4193..db74bde 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -368,7 +368,9 @@ sal_Bool BitmapEx::Scale( const Size& rNewSize, sal_uLong nScaleFlag ) { sal_Bool bRet; - if( aBitmapSize.Width() && aBitmapSize.Height() ) + if( aBitmapSize.Width() && aBitmapSize.Height() && + ( rNewSize.Width() != aBitmapSize.Width() || + rNewSize.Height() != aBitmapSize.Height() ) ) { bRet = Scale( (double) rNewSize.Width() / aBitmapSize.Width(), (double) rNewSize.Height() / aBitmapSize.Height(), _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
