[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 3 commits - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Jul 1 02:13:50 PDT 2015


 sw/source/core/view/viewsh.cxx |   42 ++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

New commits:
commit 2fa23d10c32f77da121ecf03f77ff3f10ca0d580
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 30 17:21:10 2015 +0200

    sw redercontext: fix missing draw of the overlay
    
    With this, if e.g. Ctrl-A is hit for a hello-world document, then
    selection is properly visible.
    
    Change-Id: If3fae1e73dc76c50e62f6e1f31d99873636f0e93
    (cherry picked from commit a2c4bed594013ed9d671197cde53990fcede395d)

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 71964e8..6e0a150 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -78,6 +78,7 @@
 #include <vcl/virdev.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #if !HAVE_FEATURE_DESKTOP
@@ -1685,7 +1686,19 @@ public:
     ~RenderContextGuard()
     {
         if (m_pRef != m_pShell->GetWin() && m_pShell->Imp()->GetDrawView())
+        {
+            // Need to explicitly draw the overlay on m_pRef, since by default
+            // they would be only drawn for m_pOriginalValue.
+            SdrPaintWindow* pOldPaintWindow = m_pShell->Imp()->GetDrawView()->GetPaintWindow(0);
+            rtl::Reference<sdr::overlay::OverlayManager> xOldManager = pOldPaintWindow->GetOverlayManager();
+            if (xOldManager.is())
+            {
+                SdrPaintWindow* pNewPaintWindow = m_pShell->Imp()->GetDrawView()->FindPaintWindow(*m_pRef);
+                xOldManager->completeRedraw(pNewPaintWindow->GetRedrawRegion(), m_pRef);
+            }
+
             m_pShell->Imp()->GetDrawView()->DeleteWindowFromPaintView(m_pRef);
+        }
         m_pRef = m_pOriginalValue;
     }
 };
commit f36eaa079165a9109444b785ddda5e6f92891e50
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 30 10:33:50 2015 +0200

    sw rendercontext: update drawlayer in SwViewShell::Paint
    
    Fixes warnings on startup like:
    
    warn:legacy.osl:13026:1:svx/source/svdraw/svdpntv.cxx:813: SdrPaintView::UpdateDrawLayersRegion: No SdrPaintWindow (!)
    
    when double buffering is enabled for SwEditWin.
    
    Change-Id: I3dd8019a158b7d50c5e460abf504da31aabe72c3
    (cherry picked from commit 82307b16f89250d5fd724806f51823a38f7e202f)

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 3a4af8b..71964e8 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1669,17 +1669,23 @@ class RenderContextGuard
 {
     VclPtr<vcl::RenderContext>& m_pRef;
     vcl::RenderContext* m_pOriginalValue;
+    SwViewShell* m_pShell;
 
 public:
-    RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue)
+    RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue, SwViewShell* pShell)
         : m_pRef(pRef),
-        m_pOriginalValue(m_pRef)
+        m_pOriginalValue(m_pRef),
+        m_pShell(pShell)
     {
         m_pRef = pValue;
+        if (pValue != m_pShell->GetWin() && m_pShell->Imp()->GetDrawView())
+            m_pShell->Imp()->GetDrawView()->AddWindowToPaintView(pValue);
     }
 
     ~RenderContextGuard()
     {
+        if (m_pRef != m_pShell->GetWin() && m_pShell->Imp()->GetDrawView())
+            m_pShell->Imp()->GetDrawView()->DeleteWindowFromPaintView(m_pRef);
         m_pRef = m_pOriginalValue;
     }
 };
@@ -1687,7 +1693,7 @@ public:
 
 void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const Rectangle &rRect)
 {
-    RenderContextGuard aGuard(mpOut, &rRenderContext);
+    RenderContextGuard aGuard(mpOut, &rRenderContext, this);
     if ( mnLockPaint )
     {
         if ( Imp()->bSmoothUpdate )
@@ -1846,12 +1852,6 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
     aMapMode.SetScaleY(scaleY);
     rDevice.SetMapMode(aMapMode);
 
-    // Update this device in DrawLayer
-    if (Imp()->GetDrawView())
-    {
-        Imp()->GetDrawView()->AddWindowToPaintView(&rDevice);
-    }
-
     Rectangle aOutRect = Rectangle(Point(tilePosX, tilePosY),
                                    rDevice.PixelToLogic(Size(contextWidth, contextHeight)));
 
@@ -1870,12 +1870,6 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
     // draw - works in logic coordinates
     Paint(rDevice, aOutRect);
 
-    // Remove this device in DrawLayer
-    if (Imp()->GetDrawView())
-    {
-        Imp()->GetDrawView()->DeleteWindowFromPaintView(&rDevice);
-    }
-
     // SwViewShell's output device tear down
     mpOut = pSaveOut;
     mbInLibreOfficeKitCallback = false;
commit 6c59c767c1f750c7552e8c011c8440fbde6c0536
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 30 10:15:23 2015 +0200

    SwViewShell::DLPrePaint2: paint to mpOut if isOutputToWindow()
    
    With this, most of the SwEditWin is painted to the virtual device in
    case of double buffering, not directly to the screen (avoids
    flickering).
    
    Change-Id: If93aa082daaec6b0e2c417ebc7367e5ab601aa2c
    (cherry picked from commit af9d02a24bc61c9a531157ed6a49b25c47668277)

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 13439a8..3a4af8b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -188,8 +188,9 @@ void SwViewShell::DLPrePaint2(const vcl::Region& rRegion)
         if ( !HasDrawView() )
             MakeDrawView();
 
-        // Prefer window; if tot available, get mpOut (e.g. printer)
-        mpPrePostOutDev = (GetWin() && !isTiledRendering())? GetWin(): GetOut();
+        // Prefer window; if not available, get mpOut (e.g. printer)
+        const bool bWindow = GetWin() && !isTiledRendering() && !isOutputToWindow();
+        mpPrePostOutDev = bWindow ? GetWin(): GetOut();
 
         // #i74769# use SdrPaintWindow now direct
         mpTargetPaintWindow = Imp()->GetDrawView()->BeginDrawLayers(mpPrePostOutDev, rRegion);


More information about the Libreoffice-commits mailing list