[Libreoffice-commits] .: 2 commits - i18npool/prj vcl/inc vcl/source vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Tue Mar 22 06:00:14 PDT 2011


 i18npool/prj/build.lst           |    2 +-
 vcl/inc/vcl/glyphcache.hxx       |    8 +++++---
 vcl/source/glyphs/gcach_ftyp.cxx |    5 ++---
 vcl/source/glyphs/gcach_ftyp.hxx |    6 +++---
 vcl/source/glyphs/glyphcache.cxx |    2 --
 vcl/unx/source/gdi/salgdi3.cxx   |    8 ++++----
 6 files changed, 15 insertions(+), 16 deletions(-)

New commits:
commit 22ec51681687c4d700336603f6f37e981ad37bf2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 22 12:59:42 2011 +0000

    Cut Gordian Knot of who owns the font options

diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
index 351eb13..6a375a4 100644
--- a/vcl/inc/vcl/glyphcache.hxx
+++ b/vcl/inc/vcl/glyphcache.hxx
@@ -45,6 +45,7 @@ class ImplFontOptions;
 #include <tools/gen.hxx>
 #include <boost/unordered_map.hpp>
 #include <boost/unordered_set.hpp>
+#include <boost/shared_ptr.hpp>
 
 namespace basegfx { class B2DPolyPolygon; }
 
@@ -186,8 +187,9 @@ public:
     virtual bool                TestFont() const            { return true; }
     virtual void*               GetFtFace() const { return 0; }
     virtual int                 GetLoadFlags() const { return 0; }
-    virtual void                SetFontOptions( const ImplFontOptions*) {}
-    virtual const ImplFontOptions* GetFontOptions() const { return 0; }
+    virtual void                SetFontOptions( boost::shared_ptr<ImplFontOptions> ) {}
+    virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const
+        { return boost::shared_ptr<ImplFontOptions>(); }
     virtual bool                NeedsArtificialBold() const { return false; }
     virtual bool                NeedsArtificialItalic() const { return false; }
 
@@ -266,7 +268,7 @@ class VCL_PLUGIN_PUBLIC ImplServerFontEntry : public ImplFontEntry
 {
 private:
     ServerFont*    mpServerFont;
-    ImplFontOptions* mpFontOptions;
+    boost::shared_ptr<ImplFontOptions> mpFontOptions;
     bool           mbGotFontOptions;
 
 public:
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index 3de5082..d482916 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -769,7 +769,6 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn
     mpFontInfo( pFI ),
     maFaceFT( NULL ),
     maSizeFT( NULL ),
-    mpFontOptions( NULL ),
     mbFaceOk( false ),
     maRecodeConverter( NULL ),
     mpLayoutEngine( NULL )
@@ -915,7 +914,7 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn
         mnLoadFlags |= FT_LOAD_NO_BITMAP;
 }
 
-void FreetypeServerFont::SetFontOptions( const ImplFontOptions* pFontOptions)
+void FreetypeServerFont::SetFontOptions( boost::shared_ptr<ImplFontOptions> pFontOptions)
 {
     mpFontOptions = pFontOptions;
 
@@ -970,7 +969,7 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions* pFontOptions)
         mnLoadFlags |= FT_LOAD_NO_BITMAP;
 }
 
-const ImplFontOptions* FreetypeServerFont::GetFontOptions() const
+boost::shared_ptr<ImplFontOptions> FreetypeServerFont::GetFontOptions() const
 {
     return mpFontOptions;
 }
diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx
index 8ebef45..0af4ed1 100644
--- a/vcl/source/glyphs/gcach_ftyp.hxx
+++ b/vcl/source/glyphs/gcach_ftyp.hxx
@@ -191,8 +191,8 @@ public:
     virtual int                 GetFontFaceNum() const { return mpFontInfo->GetFaceNum(); }
     virtual bool                TestFont() const;
     virtual void*               GetFtFace() const;
-    virtual void                SetFontOptions( const ImplFontOptions*);
-    virtual const ImplFontOptions*    GetFontOptions() const;
+    virtual void                SetFontOptions( boost::shared_ptr<ImplFontOptions> );
+    virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const;
     virtual int                 GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
     virtual bool                NeedsArtificialBold() const { return mbArtBold; }
     virtual bool                NeedsArtificialItalic() const { return mbArtItalic; }
@@ -239,7 +239,7 @@ private:
     FT_FaceRec_*                maFaceFT;
     FT_SizeRec_*                maSizeFT;
 
-    const ImplFontOptions*      mpFontOptions;
+    boost::shared_ptr<ImplFontOptions> mpFontOptions;
 
     bool                        mbFaceOk;
     bool			mbArtItalic;
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index 649ffb4..373c430 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -534,7 +534,6 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex )
 ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
 :   ImplFontEntry( rFSD )
 ,   mpServerFont( NULL )
-,   mpFontOptions( NULL )
 ,   mbGotFontOptions( false )
 {}
 
@@ -543,7 +542,6 @@ ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
 ImplServerFontEntry::~ImplServerFontEntry()
 {
     // TODO: remove the ServerFont here instead of in the GlyphCache
-    delete mpFontOptions;
 }
 
 // =======================================================================
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 20fd3cd..4365356 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -236,8 +236,8 @@ void ImplServerFontEntry::HandleFontOptions( void )
     {
         // get and cache the font options
         mbGotFontOptions = true;
-        mpFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
-            maFontSelData.mnHeight );
+        mpFontOptions.reset(GetFCFontOptions( *maFontSelData.mpFontData,
+            maFontSelData.mnHeight ));
     }
     // apply the font options
     mpServerFont->SetFontOptions( mpFontOptions );
@@ -536,12 +536,12 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
     void* pFace = rFont.GetFtFace();
     CairoFontsCache::CacheId aId;
     aId.mpFace = pFace;
-    aId.mpOptions = rFont.GetFontOptions();
+    aId.mpOptions = rFont.GetFontOptions().get();
     aId.mbEmbolden = rFont.NeedsArtificialBold();
     font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(aId);
     if (!font_face)
     {
-        const ImplFontOptions *pOptions = rFont.GetFontOptions();
+        const ImplFontOptions *pOptions = rFont.GetFontOptions().get();
         void *pPattern = pOptions ? pOptions->GetPattern(pFace, aId.mbEmbolden) : NULL;
         if (pPattern)
             font_face = rCairo.ft_font_face_create_for_pattern(pPattern);
commit d320abb6b91f8cc48fb1b5cb919578768c47e119
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Mar 21 20:19:31 2011 +0000

    add cppunit depend

diff --git a/i18npool/prj/build.lst b/i18npool/prj/build.lst
index 9e1b5c8..3a2e0c2 100644
--- a/i18npool/prj/build.lst
+++ b/i18npool/prj/build.lst
@@ -1,4 +1,4 @@
-inp  i18npool    :   bridges sax stoc comphelper ICU:icu i18nutil regexp cpputools LIBXSLT:libxslt NULL
+inp  i18npool    :   bridges sax stoc comphelper CPPUNIT:cppunit ICU:icu i18nutil regexp cpputools LIBXSLT:libxslt NULL
 inp  i18npool                                   usr1    -   all inp_mkout NULL
 inp  i18npool\inc                               nmake   -   all inp_inc NULL
 inp  i18npool\source\registerservices           nmake   -   all inp_rserv inp_inc NULL


More information about the Libreoffice-commits mailing list