parent
7ce6c87946
commit
bba109e020
@ -0,0 +1,153 @@
|
||||
From 22ec51681687c4d700336603f6f37e981ad37bf2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||||
Date: Tue, 22 Mar 2011 12:59:42 +0000
|
||||
Subject: [PATCH] Cut Gordian Knot of who owns the font options
|
||||
|
||||
---
|
||||
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 ++++----
|
||||
5 files changed, 14 insertions(+), 15 deletions(-)
|
||||
|
||||
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);
|
||||
--
|
||||
1.7.4.1
|
||||
|
Loading…
Reference in new issue