[Libreoffice-commits] core.git: vcl/coretext vcl/inc

Tor Lillqvist tml at collabora.com
Thu Nov 28 14:07:00 PST 2013


 vcl/coretext/ctfonts.cxx   |   39 ++++++++-------------------------------
 vcl/coretext/salgdi2.cxx   |    6 ------
 vcl/inc/coretext/salgdi2.h |   17 ++++++++++++++---
 3 files changed, 22 insertions(+), 40 deletions(-)

New commits:
commit 47fbe385f55c05935c87610b987724e5fb4752c0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Nov 29 00:04:35 2013 +0200

    Avoid pointless class derivation for the CoreText SystemFontList
    
    Change-Id: Ib3e6705d166dec9d7db8787496947faf73e3cfb3

diff --git a/vcl/coretext/ctfonts.cxx b/vcl/coretext/ctfonts.cxx
index bdfcfc6..f7fdc8e 100644
--- a/vcl/coretext/ctfonts.cxx
+++ b/vcl/coretext/ctfonts.cxx
@@ -36,29 +36,6 @@
 
 // =======================================================================
 
-class CTFontList
-:   public SystemFontList
-{
-public:
-    explicit    CTFontList( void );
-    virtual     ~CTFontList( void );
-
-    bool        Init( void );
-    void        AddFont( CoreTextFontData* );
-
-    virtual void    AnnounceFonts( ImplDevFontList& ) const;
-    virtual CoreTextFontData* GetFontDataFromId( sal_IntPtr ) const;
-
-private:
-    CTFontCollectionRef mpCTFontCollection;
-    CFArrayRef mpCTFontArray;
-
-    typedef boost::unordered_map<sal_IntPtr,CoreTextFontData*> CTFontContainer;
-    CTFontContainer maFontContainer;
-};
-
-// =======================================================================
-
 inline double toRadian(int nDegree)
 {
     return nDegree * (M_PI / 1800.0);
@@ -411,21 +388,21 @@ static void CTFontEnumCallBack( const void* pValue, void* pContext )
     {
         const sal_IntPtr nFontId = (sal_IntPtr)pValue;
         CoreTextFontData* pFontData = new CoreTextFontData( rDFA, nFontId );
-        CTFontList* pFontList = (CTFontList*)pContext;
+        SystemFontList* pFontList = (SystemFontList*)pContext;
         pFontList->AddFont( pFontData );
     }
 }
 
 // =======================================================================
 
-CTFontList::CTFontList()
+SystemFontList::SystemFontList()
 :   mpCTFontCollection( NULL )
 ,   mpCTFontArray( NULL )
 {}
 
 // -----------------------------------------------------------------------
 
-CTFontList::~CTFontList()
+SystemFontList::~SystemFontList()
 {
     CTFontContainer::const_iterator it = maFontContainer.begin();
     for(; it != maFontContainer.end(); ++it )
@@ -440,7 +417,7 @@ CTFontList::~CTFontList()
 
 // -----------------------------------------------------------------------
 
-void CTFontList::AddFont( CoreTextFontData* pFontData )
+void SystemFontList::AddFont( CoreTextFontData* pFontData )
 {
     sal_IntPtr nFontId = pFontData->GetFontId();
     maFontContainer[ nFontId ] = pFontData;
@@ -448,7 +425,7 @@ void CTFontList::AddFont( CoreTextFontData* pFontData )
 
 // -----------------------------------------------------------------------
 
-void CTFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
+void SystemFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
 {
     CTFontContainer::const_iterator it = maFontContainer.begin();
     for(; it != maFontContainer.end(); ++it )
@@ -457,7 +434,7 @@ void CTFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
 
 // -----------------------------------------------------------------------
 
-CoreTextFontData* CTFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
+CoreTextFontData* SystemFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
 {
     CTFontContainer::const_iterator it = maFontContainer.find( nFontId );
     if( it == maFontContainer.end() )
@@ -467,7 +444,7 @@ CoreTextFontData* CTFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
 
 // -----------------------------------------------------------------------
 
-bool CTFontList::Init( void )
+bool SystemFontList::Init( void )
 {
     // enumerate available system fonts
     static const int nMaxDictEntries = 8;
@@ -489,7 +466,7 @@ bool CTFontList::Init( void )
 
 SystemFontList* GetCoretextFontList( void )
 {
-    CTFontList* pList = new CTFontList();
+    SystemFontList* pList = new SystemFontList();
     if( !pList->Init() ) {
         delete pList;
         return NULL;
diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx
index c15e4aa..801548a 100644
--- a/vcl/coretext/salgdi2.cxx
+++ b/vcl/coretext/salgdi2.cxx
@@ -61,12 +61,6 @@ using namespace vcl;
 
 // =======================================================================
 
-SystemFontList::~SystemFontList( void )
-{}
-
-
-// =======================================================================
-
 CoreTextFontData::CoreTextFontData( const CoreTextFontData& rSrc )
 :   PhysicalFontFace( rSrc )
 ,   mnFontId( rSrc.mnFontId )
diff --git a/vcl/inc/coretext/salgdi2.h b/vcl/inc/coretext/salgdi2.h
index 3186461..b121f71 100644
--- a/vcl/inc/coretext/salgdi2.h
+++ b/vcl/inc/coretext/salgdi2.h
@@ -119,10 +119,21 @@ private:
 class SystemFontList
 {
 public:
-    virtual ~SystemFontList( void );
+    SystemFontList( void );
+    ~SystemFontList( void );
 
-    virtual void    AnnounceFonts( ImplDevFontList& ) const = 0;
-    virtual CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const = 0;
+    bool        Init( void );
+    void        AddFont( CoreTextFontData* );
+
+    void    AnnounceFonts( ImplDevFontList& ) const;
+    CoreTextFontData* GetFontDataFromId( sal_IntPtr nFontId ) const;
+
+private:
+    CTFontCollectionRef mpCTFontCollection;
+    CFArrayRef mpCTFontArray;
+
+    typedef boost::unordered_map<sal_IntPtr,CoreTextFontData*> CTFontContainer;
+    CTFontContainer maFontContainer;
 };
 
 #ifdef MACOSX


More information about the Libreoffice-commits mailing list