[Libreoffice-commits] core.git: sdext/source

Caolán McNamara caolanm at redhat.com
Wed Mar 8 14:19:58 UTC 2017


 sdext/source/pdfimport/wrapper/wrapper.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 8f0e7b3b36fbb1f8ebdc854e92b50866b6746e62
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 8 14:05:47 2017 +0000

    just make the VirtualDevice a parser member
    
    rather than over complicating things
    
    Change-Id: Ife65207dab8ddfedb6a9cbe111adf13fd03b5b3b

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index ff09305..bb15a58 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -146,6 +146,7 @@ class Parser
     typedef std::unordered_map< sal_Int64,
                            FontAttributes > FontMapType;
 
+    ScopedVclPtr<VirtualDevice> m_xDev;
     const uno::Reference<uno::XComponentContext> m_xContext;
     const ContentSinkSharedPtr                   m_pSink;
     const oslFileHandle                          m_pErr;
@@ -668,13 +669,12 @@ void Parser::readFont()
 
     }
 
-    static vcl::DeleteOnDeinit< VclPtr<VirtualDevice> > vDev( new VclPtr<VirtualDevice> );
-    if (!vDev.get()->get())
-        (*vDev.get()) = VclPtr<VirtualDevice>::Create();
+    if (!m_xDev)
+        m_xDev.disposeAndReset(VclPtr<VirtualDevice>::Create());
 
     vcl::Font font(aResult.familyName, Size(0, 1000));
-    (*vDev.get())->SetFont(font);
-    FontMetric metric((*vDev.get())->GetFontMetric());
+    m_xDev->SetFont(font);
+    FontMetric metric(m_xDev->GetFontMetric());
     aResult.ascent = metric.GetAscent() / 1000.0;
 
     m_aFontMap[nFontID] = aResult;


More information about the Libreoffice-commits mailing list