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

Miklos Vajna vmiklos at collabora.co.uk
Mon Jun 29 09:34:36 PDT 2015


 sw/source/core/view/viewsh.cxx |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 98d2d985082114ec259c11788af7b8574f2c9b3d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 29 17:05:50 2015 +0200

    SwViewShell::Paint: restore old render context at the end
    
    The idea is that mpOut is only used for non-drawing purposes outside
    Paint(), e.g. to do logic <-> pixel conversion.
    
    Change-Id: Ia83cd32dd0a5152dcfc1644e92af08b4ddf4653c
    Reviewed-on: https://gerrit.libreoffice.org/16584
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 4ace932..7998259 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1664,9 +1664,32 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
     return bRet;
 }
 
+namespace
+{
+/// Similar to comphelper::FlagRestorationGuard, but for vcl::RenderContext.
+class RenderContextGuard
+{
+    VclPtr<vcl::RenderContext>& m_pRef;
+    vcl::RenderContext* m_pOriginalValue;
+
+public:
+    RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue)
+        : m_pRef(pRef),
+        m_pOriginalValue(m_pRef)
+    {
+        m_pRef = pValue;
+    }
+
+    ~RenderContextGuard()
+    {
+        m_pRef = m_pOriginalValue;
+    }
+};
+}
+
 void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect)
 {
-    mpOut = &rRenderContext;
+    RenderContextGuard aGuard(mpOut, &rRenderContext);
     if ( mnLockPaint )
     {
         if ( Imp()->bSmoothUpdate )


More information about the Libreoffice-commits mailing list