[Libreoffice-commits] core.git: editeng/source include/vcl svx/source sw/source vcl/source vcl/workben

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 17 08:59:26 UTC 2020


 editeng/source/editeng/impedit3.cxx |    6 ------
 include/vcl/font.hxx                |    2 +-
 svx/source/fmcomp/gridctrl.cxx      |    1 -
 svx/source/gallery2/galbrws2.cxx    |    1 -
 svx/source/tbxctrls/tbcontrl.cxx    |    2 --
 sw/source/uibase/utlui/glbltree.cxx |    1 -
 vcl/source/control/calendar.cxx     |    3 ---
 vcl/source/edit/texteng.cxx         |    2 --
 vcl/workben/vcldemo.cxx             |   11 ++++++-----
 9 files changed, 7 insertions(+), 22 deletions(-)

New commits:
commit fb032d58c71fc2d5c199b24b669a69ce119fff80
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jan 16 17:34:47 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jan 17 09:58:50 2020 +0100

    flush out unused Font objects
    
    Change-Id: Ifd6379b2cb6e5945ff509be8dc61c61bd70724c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86938
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 58c90a589dcb..45205eaa2ab9 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -372,8 +372,6 @@ void ImpEditEngine::FormatDoc()
     long nY = 0;
     bool bGrow = false;
 
-    vcl::Font aOldFont( GetRefDevice()->GetFont() );
-
     // Here already, so that not always in CreateLines...
     bool bMapChanged = ImpCheckRefMapMode();
 
@@ -2954,7 +2952,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
     Point aRedLineTmpPos;
     DBG_ASSERT( GetParaPortions().Count(), "No ParaPortion?!" );
     SvxFont aTmpFont( GetParaPortions()[0]->GetNode()->GetCharAttribs().GetDefFont() );
-    vcl::Font aOldFont( pOutDev->GetFont() );
     vcl::PDFExtOutDevData* pPDFExtOutDevData = dynamic_cast< vcl::PDFExtOutDevData* >( pOutDev->GetExtOutDevData() );
 
     // In the case of rotated text is aStartPos considered TopLeft because
@@ -3352,7 +3349,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
 
                                     pTmpDXArray.reset(new long[ aText.getLength() ]);
                                     pDXArray = pTmpDXArray.get();
-                                    vcl::Font _aOldFont( GetRefDevice()->GetFont() );
                                     aTmpFont.SetPhysFont( GetRefDevice() );
                                     aTmpFont.QuickGetTextSize( GetRefDevice(), aText, nTextStart, nTextLen, pTmpDXArray.get() );
 
@@ -3380,7 +3376,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                     // crash when accessing 0 pointer in pDXArray
                                     pTmpDXArray.reset(new long[ aText.getLength() ]);
                                     pDXArray = pTmpDXArray.get();
-                                    vcl::Font _aOldFont( GetRefDevice()->GetFont() );
                                     aTmpFont.SetPhysFont( GetRefDevice() );
                                     aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.getLength(), pTmpDXArray.get() );
                                 }
@@ -3973,7 +3968,6 @@ void ImpEditEngine::ShowParagraph( sal_Int32 nParagraph, bool bShow )
             {
                 if ( pPPortion->IsInvalid() )
                 {
-                    vcl::Font aOldFont( GetRefDevice()->GetFont() );
                     CreateLines( nParagraph, 0 );   // 0: No TextRanger
                 }
                 else
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index ac8c6d4c2153..faccd0cff1a5 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -43,7 +43,7 @@ VCL_DLLPUBLIC SvStream&  WriteFont( SvStream& rOStm, const vcl::Font& );
 
 namespace vcl {
 
-class VCL_DLLPUBLIC Font
+class SAL_WARN_UNUSED VCL_DLLPUBLIC Font
 {
 public:
     explicit            Font();
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 8b74b76a3ca7..f0867f5743ed 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1108,7 +1108,6 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat )
     {
         if ( m_bNavigationBar )
         {
-            vcl::Font aFont = m_aBar->GetSettings().GetStyleSettings().GetToolFont();
             if ( IsControlFont() )
                 m_aBar->SetControlFont( GetControlFont() );
             else
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 9109b81ad4c7..fa6d187c8c6c 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -391,7 +391,6 @@ GalleryBrowser2::GalleryBrowser2( vcl::Window* pParent, Gallery* pGallery ) :
         css::uno::UNO_QUERY );
 
     Image      aDummyImage;
-    vcl::Font  aInfoFont( maInfoBar->GetControlFont() );
 
     maMiscOptions.AddListenerLink( LINK( this, GalleryBrowser2, MiscHdl ) );
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 951fc284280e..bf99813bed76 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1059,8 +1059,6 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo
                     aFont.SetEmphasisMark( static_cast< const SvxEmphasisMarkItem* >( pItem )->GetEmphasisMark() );
 
                 // setup the device & draw
-                vcl::Font aOldFont(rRenderContext.GetFont());
-
                 Color aFontCol = COL_AUTO, aBackCol = COL_AUTO;
 
                 rRenderContext.SetFont(aFont);
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 82f3ea738e90..a48db512fea8 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1238,7 +1238,6 @@ void SwLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderCont
       !pCont->GetSection()->IsConnectFlag())
     {
         rRenderContext.Push(PushFlags::FONT);
-        vcl::Font aOldFont(rRenderContext.GetFont());
         vcl::Font aFont(rRenderContext.GetFont());
         aFont.SetColor(COL_LIGHTRED);
         rRenderContext.SetFont(aFont);
diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx
index 22d3d9f56ab3..0baecf397d5f 100644
--- a/vcl/source/control/calendar.cxx
+++ b/vcl/source/control/calendar.cxx
@@ -204,8 +204,6 @@ void Calendar::ImplFormat()
 
         OUString const a99Text("99");
 
-        vcl::Font aOldFont = GetFont();
-
         long n99TextWidth = GetTextWidth( a99Text );
         long nTextHeight = GetTextHeight();
 
@@ -1532,7 +1530,6 @@ void Calendar::EndSelection()
 Size Calendar::CalcWindowSizePixel() const
 {
     OUString  const a99Text("99");
-    vcl::Font aOldFont = GetFont();
 
     Size    aSize;
     long    n99TextWidth = GetTextWidth( a99Text );
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 397a1de8a23a..9ceb0c83542e 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2135,8 +2135,6 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
     sal_Int32 nIndex = pLine->GetStart();
     TextLine aSaveLine( *pLine );
 
-    vcl::Font aFont;
-
     while ( nIndex < pNode->GetText().getLength() )
     {
         bool bEOL = false;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 2698d350caae..97b51bbb8f00 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -2237,17 +2237,18 @@ public:
 };
 
 namespace {
-    void renderFonts(const std::vector<OUString> &aFontNames)
+    void renderFonts()
     {
         ScopedVclPtrInstance<VirtualDevice> xDevice;
         Size aSize(1024, 1024);
         xDevice->SetOutputSizePixel(aSize);
 
+#if 0
         for (auto & aFontName : aFontNames)
         {
             vcl::Font aFont(aFontName, Size(0,96));
-#if 0
-            aFont.SetCOL_BLACK);
+
+            aFont.Set(COL_BLACK);
             xDevice->SetFont(aFont);
             xDevice->Erase();
 
@@ -2288,8 +2289,8 @@ include/vcl/outdev.hxx:                                              DrawTextFla
                                              TextRectInfo* pInfo = nullptr,
                                              const vcl::ITextLayout* _pTextLayout = nullptr ) const;
 
-#endif
         }
+#endif
 
     }
 };
@@ -2384,7 +2385,7 @@ public:
             else if (bPopup)
                 xPopup = VclPtrInstance< DemoPopup> ();
             else if (!aFontNames.empty())
-                renderFonts(aFontNames);
+                renderFonts();
             else
                 aMainWin->Show();
 


More information about the Libreoffice-commits mailing list