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

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 30 02:10:16 PDT 2015


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

New commits:
commit 82307b16f89250d5fd724806f51823a38f7e202f
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

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 33e85d1..d65d213 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 af9d02a24bc61c9a531157ed6a49b25c47668277
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

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index a835373..33e85d1 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