[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sw/inc sw/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue May 10 07:50:31 PDT 2011


 sw/inc/viewsh.hxx              |    5 +++--
 sw/source/core/view/viewsh.cxx |   28 +++++++++++++++++++++-------
 sw/source/core/view/vnew.cxx   |    2 --
 3 files changed, 24 insertions(+), 11 deletions(-)

New commits:
commit 93896af9984fb6a3dae981cf2ef9f335cc90f88e
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue May 10 16:33:13 2011 +0200

    update SdrPaintView's region when it changes in writer (bnc#683550)
    
    ViewShell::DLPrePaint2() gets a region as an argument, but uses it
    only during the first call, following calls only increment the lock
    counter, so if the region changes, the change doesn't take effect,
    causing redraw problems. So the fix is the replace the lock counter
    with a stack of used regions and update the region as appropriate.

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 39df2c9..1767570 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -37,6 +37,7 @@
 #include <ring.hxx>
 #include <swrect.hxx>
 #include <boost/shared_ptr.hpp>// swmod 080115
+#include <stack>
 #include <vcl/mapmod.hxx>
 #include <vcl/print.hxx>
 
@@ -236,7 +237,7 @@ public:
     //////////////////////////////////////////////////////////////////////////////
     // #i72754# set of Pre/PostPaints with lock counter and initial target OutDev
 protected:
-    sal_uInt32				mnPrePostPaintCount;
+    std::stack<Region>			mPrePostPaintRegions; // acts also as a lock counter (empty == not locked)
     OutputDevice*			mpPrePostOutDev;
     MapMode					maPrePostMapMode;
 public:
@@ -248,7 +249,7 @@ public:
 
     virtual void Paint(const Rectangle &rRect);
     sal_Bool IsPaintInProgress() const { return bPaintInProgress; }
-    bool IsDrawingLayerPaintInProgress() const { return 0 != mnPrePostPaintCount; }
+    bool IsDrawingLayerPaintInProgress() const { return !mPrePostPaintRegions.empty(); }
 
     //Benachrichtung, dass sich der sichtbare Bereich geaendert hat.
     //VisArea wird neu gesetzt, anschliessend wird gescrollt.
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 9903f97..3917439 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -98,7 +98,7 @@ using namespace ::com::sun::star;
 
 //////////////////////////////////////////////////////////////////////////////
 // #i72754# 2nd set of Pre/PostPaints
-// This time it uses the lock counter mnPrePostPaintCount to allow only one activation
+// This time it uses the lock counter (mPrePostPaintRegions empty/non-empty) to allow only one activation
 // and deactivation and mpPrePostOutDev to remember the OutDev from the BeginDrawLayers
 // call. That way, all places where paint take place can be handled the same way, even
 // when calling other paint methods. This is the case at the places where SW paints
@@ -116,8 +116,9 @@ void ViewShell::PrePaint()
 
 void ViewShell::DLPrePaint2(const Region& rRegion)
 {
-    if(0L == mnPrePostPaintCount)
+    if(mPrePostPaintRegions.empty())
     {
+        mPrePostPaintRegions.push( rRegion );
         // #i75172# ensure DrawView to use DrawingLayer bufferings
         if ( !HasDrawView() )
             MakeDrawView();
@@ -139,16 +140,29 @@ void ViewShell::DLPrePaint2(const Region& rRegion)
         // remember original paint MapMode for wrapped FlyFrame paints
         maPrePostMapMode = pOut->GetMapMode();
     }
-
-    mnPrePostPaintCount++;
+    else
+    {
+        // region needs to be updated to the given one
+        if( mPrePostPaintRegions.top() != rRegion )
+            Imp()->GetDrawView()->UpdateDrawLayersRegion(mpPrePostOutDev, rRegion);
+        mPrePostPaintRegions.push( rRegion );
+    }
 }
 
 void ViewShell::DLPostPaint2(bool bPaintFormLayer)
 {
-    OSL_ENSURE(mnPrePostPaintCount > 0L, "ViewShell::DLPostPaint2: Pre/PostPaint encapsulation broken (!)");
-    mnPrePostPaintCount--;
+    OSL_ENSURE(!mPrePostPaintRegions.empty(), "ViewShell::DLPostPaint2: Pre/PostPaint encapsulation broken (!)");
 
-    if((0L == mnPrePostPaintCount) && (0 != mpTargetPaintWindow))
+    if( mPrePostPaintRegions.size() > 1 )
+    {
+        Region current = mPrePostPaintRegions.top();
+        mPrePostPaintRegions.pop();
+        if( current != mPrePostPaintRegions.top())
+            Imp()->GetDrawView()->UpdateDrawLayersRegion(mpPrePostOutDev, mPrePostPaintRegions.top());
+        return;
+    }
+    mPrePostPaintRegions.pop(); // clear
+    if(0 != mpTargetPaintWindow)
     {
         // #i74769# restore buffered OutDev
         if(mpTargetPaintWindow->GetPreRenderDevice())
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index cd3c810..5cfb482 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -158,7 +158,6 @@ ViewShell::ViewShell( SwDoc& rDocument, Window *pWindow,
     pDoc( &rDocument ),
     nStartAction( 0 ),
     nLockPaint( 0 ),
-    mnPrePostPaintCount(0L),
     mpPrePostOutDev(0),
     maPrePostMapMode()
 {
@@ -226,7 +225,6 @@ ViewShell::ViewShell( ViewShell& rShell, Window *pWindow,
     pDoc( rShell.GetDoc() ),
     nStartAction( 0 ),
     nLockPaint( 0 ),
-    mnPrePostPaintCount(0L),
     mpPrePostOutDev(0),
     maPrePostMapMode()
 {


More information about the Libreoffice-commits mailing list