Kaydet (Commit) 17f6ebef authored tarafından Caolán McNamara's avatar Caolán McNamara

valgrind: scary warning that the cairo font options were deleted before use

Change-Id: I58427aafb30eca64a67bcf7dd9a7738d8da3e085
(cherry picked from commit 3520b0f8)
üst 22c27688
...@@ -445,9 +445,6 @@ public: ...@@ -445,9 +445,6 @@ public:
void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider ); void SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider );
bool GetPrimaryButtonWarpsSlider() const; bool GetPrimaryButtonWarpsSlider() const;
void SetCairoFontOptions( const void *pOptions );
const void* GetCairoFontOptions() const;
void SetAppFont( const vcl::Font& rFont ); void SetAppFont( const vcl::Font& rFont );
const vcl::Font& GetAppFont() const; const vcl::Font& GetAppFont() const;
......
...@@ -62,6 +62,8 @@ enum class SalFrameStyleFlags; ...@@ -62,6 +62,8 @@ enum class SalFrameStyleFlags;
enum SalYieldResult { EVENT, TIMEOUT }; enum SalYieldResult { EVENT, TIMEOUT };
typedef struct _cairo_font_options cairo_font_options_t;
class VCL_PLUGIN_PUBLIC SalInstance class VCL_PLUGIN_PUBLIC SalInstance
{ {
private: private:
...@@ -178,6 +180,8 @@ public: ...@@ -178,6 +180,8 @@ public:
/// get information about underlying versions /// get information about underlying versions
virtual OUString getOSVersion() { return OUString("-"); } virtual OUString getOSVersion() { return OUString("-"); }
virtual const cairo_font_options_t* GetCairoFontOptions() { return nullptr; }
}; };
// called from SVMain // called from SVMain
......
...@@ -96,6 +96,8 @@ public: ...@@ -96,6 +96,8 @@ public:
virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override; virtual css::uno::Reference< css::uno::XInterface > CreateClipboard( const css::uno::Sequence< css::uno::Any >& i_rArguments ) override;
#endif #endif
virtual const cairo_font_options_t* GetCairoFontOptions() override;
void RemoveTimer (SalTimer *pTimer); void RemoveTimer (SalTimer *pTimer);
std::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const; std::shared_ptr<vcl::unx::GtkPrintWrapper> getPrintWrapper() const;
......
...@@ -194,7 +194,6 @@ struct ImplStyleData ...@@ -194,7 +194,6 @@ struct ImplStyleData
bool mbPrimaryButtonWarpsSlider; bool mbPrimaryButtonWarpsSlider;
DialogStyle maDialogStyle; DialogStyle maDialogStyle;
FrameStyle maFrameStyle; FrameStyle maFrameStyle;
const void* mpFontOptions;
sal_uInt16 mnEdgeBlending; sal_uInt16 mnEdgeBlending;
Color maEdgeBlendingTopLeftColor; Color maEdgeBlendingTopLeftColor;
...@@ -549,7 +548,6 @@ ImplStyleData::ImplStyleData() : ...@@ -549,7 +548,6 @@ ImplStyleData::ImplStyleData() :
mbAutoMnemonic = true; mbAutoMnemonic = true;
mnToolbarIconSize = ToolbarIconSize::Unknown; mnToolbarIconSize = ToolbarIconSize::Unknown;
meUseImagesInMenus = TRISTATE_INDET; meUseImagesInMenus = TRISTATE_INDET;
mpFontOptions = nullptr;
mnEdgeBlending = 35; mnEdgeBlending = 35;
maEdgeBlendingTopLeftColor = RGB_COLORDATA(0xC0, 0xC0, 0xC0); maEdgeBlendingTopLeftColor = RGB_COLORDATA(0xC0, 0xC0, 0xC0);
maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40); maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40);
...@@ -670,7 +668,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : ...@@ -670,7 +668,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
mnToolbarIconSize = rData.mnToolbarIconSize; mnToolbarIconSize = rData.mnToolbarIconSize;
mIconThemeScanner.reset(new vcl::IconThemeScanner(*rData.mIconThemeScanner)); mIconThemeScanner.reset(new vcl::IconThemeScanner(*rData.mIconThemeScanner));
mIconThemeSelector.reset(new vcl::IconThemeSelector(*rData.mIconThemeSelector)); mIconThemeSelector.reset(new vcl::IconThemeSelector(*rData.mIconThemeSelector));
mpFontOptions = rData.mpFontOptions;
mnEdgeBlending = rData.mnEdgeBlending; mnEdgeBlending = rData.mnEdgeBlending;
maEdgeBlendingTopLeftColor = rData.maEdgeBlendingTopLeftColor; maEdgeBlendingTopLeftColor = rData.maEdgeBlendingTopLeftColor;
maEdgeBlendingBottomRightColor = rData.maEdgeBlendingBottomRightColor; maEdgeBlendingBottomRightColor = rData.maEdgeBlendingBottomRightColor;
...@@ -1545,19 +1542,6 @@ StyleSettings::GetPrimaryButtonWarpsSlider() const ...@@ -1545,19 +1542,6 @@ StyleSettings::GetPrimaryButtonWarpsSlider() const
return mxData->mbPrimaryButtonWarpsSlider; return mxData->mbPrimaryButtonWarpsSlider;
} }
void
StyleSettings::SetCairoFontOptions( const void *pOptions )
{
CopyData();
mxData->mpFontOptions = pOptions;
}
const void*
StyleSettings::GetCairoFontOptions() const
{
return mxData->mpFontOptions;
}
void void
StyleSettings::SetAppFont( const vcl::Font& rFont ) StyleSettings::SetAppFont( const vcl::Font& rFont )
{ {
......
...@@ -212,8 +212,9 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) ...@@ -212,8 +212,9 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout )
return; return;
} }
if (const void *pOptions = Application::GetSettings().GetStyleSettings().GetCairoFontOptions()) ImplSVData* pSVData = ImplGetSVData();
cairo_set_font_options(cr, static_cast<const cairo_font_options_t*>(pOptions)); if (const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions())
cairo_set_font_options(cr, pFontOptions);
double nDX, nDY; double nDX, nDY;
getSurfaceOffset(nDX, nDY); getSurfaceOffset(nDX, nDY);
...@@ -429,12 +430,11 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection ) ...@@ -429,12 +430,11 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection )
void cairosubcallback(void* pPattern) void cairosubcallback(void* pPattern)
{ {
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); ImplSVData* pSVData = ImplGetSVData();
const void* pFontOptions = rStyleSettings.GetCairoFontOptions(); const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions();
if( !pFontOptions ) if( !pFontOptions )
return; return;
cairo_ft_font_options_substitute(static_cast<const cairo_font_options_t*>(pFontOptions), cairo_ft_font_options_substitute(pFontOptions, static_cast<FcPattern*>(pPattern));
static_cast<FcPattern*>(pPattern));
} }
FontConfigFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize) FontConfigFontOptions* GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize)
......
...@@ -468,4 +468,9 @@ GtkInstance::getPrintWrapper() const ...@@ -468,4 +468,9 @@ GtkInstance::getPrintWrapper() const
return m_xPrintWrapper; return m_xPrintWrapper;
} }
const cairo_font_options_t* GtkInstance::GetCairoFontOptions()
{
return gdk_screen_get_font_options(gdk_screen_get_default());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -3918,7 +3918,6 @@ void GtkSalGraphics::refreshFontconfig( GtkSettings *pSettings ) ...@@ -3918,7 +3918,6 @@ void GtkSalGraphics::refreshFontconfig( GtkSettings *pSettings )
void GtkSalGraphics::updateSettings( AllSettings& rSettings ) void GtkSalGraphics::updateSettings( AllSettings& rSettings )
{ {
GdkScreen* pScreen = gtk_widget_get_screen( m_pWindow );
gtk_widget_ensure_style( m_pWindow ); gtk_widget_ensure_style( m_pWindow );
GtkStyle* pStyle = gtk_widget_get_style( m_pWindow ); GtkStyle* pStyle = gtk_widget_get_style( m_pWindow );
GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow ); GtkSettings* pSettings = gtk_widget_get_settings( m_pWindow );
...@@ -4244,9 +4243,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -4244,9 +4243,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large ); aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large );
const cairo_font_options_t* pNewOptions = gdk_screen_get_font_options( pScreen );
aStyleSet.SetCairoFontOptions( pNewOptions );
// finally update the collected settings // finally update the collected settings
rSettings.SetStyleSettings( aStyleSet ); rSettings.SetStyleSettings( aStyleSet );
} }
......
...@@ -1450,7 +1450,6 @@ static inline ::Color getColorFromColor( const GdkColor& rCol ) ...@@ -1450,7 +1450,6 @@ static inline ::Color getColorFromColor( const GdkColor& rCol )
void GtkSalGraphics::updateSettings( AllSettings& rSettings ) void GtkSalGraphics::updateSettings( AllSettings& rSettings )
{ {
GdkScreen* pScreen = gtk_widget_get_screen( mpWindow );
GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow ); GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow );
GtkSettings* pSettings = gtk_widget_get_settings( mpWindow ); GtkSettings* pSettings = gtk_widget_get_settings( mpWindow );
StyleSettings aStyleSet = rSettings.GetStyleSettings(); StyleSettings aStyleSet = rSettings.GetStyleSettings();
...@@ -1799,8 +1798,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) ...@@ -1799,8 +1798,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large ); aStyleSet.SetToolbarIconSize( ToolbarIconSize::Large );
const cairo_font_options_t* pNewOptions = gdk_screen_get_font_options(pScreen);
aStyleSet.SetCairoFontOptions( pNewOptions );
// finally update the collected settings // finally update the collected settings
rSettings.SetStyleSettings( aStyleSet ); rSettings.SetStyleSettings( aStyleSet );
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment