[Libreoffice-commits] .: svx/inc svx/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue May 10 07:41:17 PDT 2011


 svx/inc/svx/svdpntv.hxx       |    4 +
 svx/source/svdraw/svdpntv.cxx |  106 +++++++++++++++++++++++++-----------------
 2 files changed, 69 insertions(+), 41 deletions(-)

New commits:
commit d47f338d7038595f5142bf53ea763491b6b53c40
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue May 10 16:31:43 2011 +0200

    make it possible to update the region passed to BeginDrawLayers() (bnc#683550)
    
    Writer needs this, as it changes the region during painting.

diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx
index cb9c97e..b300cf9 100644
--- a/svx/inc/svx/svdpntv.hxx
+++ b/svx/inc/svx/svdpntv.hxx
@@ -400,6 +400,8 @@ public:
     // #i74769# Interface change to use common BeginCompleteRedraw/EndCompleteRedraw
     // #i76114# bDisableIntersect disables intersecting rReg with the Window's paint region
     SdrPaintWindow* BeginDrawLayers(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect = false);
+    // used when the region passed to BeginDrawLayers needs to be changed
+    void UpdateDrawLayersRegion(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect = false);
     void EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
 
 protected:
@@ -412,6 +414,8 @@ protected:
     // used to paint the form layer after the PreRender device is flushed (painted) to the window.
     void ImpFormLayerDrawing(SdrPaintWindow& rPaintWindow) const;
 
+    Region OptimizeDrawLayersRegion(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect);
+
 public:
     sal_Bool IsPageVisible() const { return bPageVisible; }             // Seite (weisse Flaeche) malen oder nicht
     sal_Bool IsPageBorderVisible() const { return bPageBorderVisible; } // Seite (weisse Flaeche) malen oder nicht
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index cbbd768..4e1990e 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -964,47 +964,7 @@ SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region&
 
         if(pKnownTarget)
         {
-            // #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
-            // rReg may be made more granular (fine) with using it. Normally, rReg
-            // does come from Window::Paint() anyways and thus is based on a single
-            // rectangle which was derived from exactly that repaint region
-            Region aOptimizedRepaintRegion(rReg);
-
-            // #i76114# Intersecting the region with the Window's paint region is disabled
-            // for print preview in Calc, because the intersection can be empty (if the paint
-            // region is outside of the table area of the page), and then no clip region
-            // would be set.
-            if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect)
-            {
-                Window* pWindow = (Window*)pOut;
-
-                if(pWindow->IsInPaint())
-                {
-                    if(!pWindow->GetPaintRegion().IsEmpty())
-                    {
-                        aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
-
-#ifdef DBG_UTIL
-                        // #i74769# test-paint repaint region
-                        static bool bDoPaintForVisualControl(false);
-                        if(bDoPaintForVisualControl)
-                        {
-                            RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
-                            Rectangle aRegionRectangle;
-                            
-                            while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
-                            {
-                                pWindow->SetLineColor(COL_LIGHTGREEN);
-                                pWindow->SetFillColor();
-                                pWindow->DrawRect(aRegionRectangle);
-                            }
-
-                            aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
-                        }
-#endif
-                    }
-                }
-            }
+            Region aOptimizedRepaintRegion = OptimizeDrawLayersRegion( pOut, rReg, bDisableIntersect );
 
             // prepare redraw
             pKnownTarget->PrepareRedraw(aOptimizedRepaintRegion);
@@ -1029,6 +989,70 @@ void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLa
     }
 }
 
+void SdrPaintView::UpdateDrawLayersRegion(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect)
+{
+    SdrPaintWindow* pPaintWindow = FindPaintWindow(*pOut);
+    OSL_ENSURE(pPaintWindow, "SdrPaintView::UpdateDrawLayersRegion: No SdrPaintWindow (!)");
+
+    if(mpPageView)
+    {
+        SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(*pPaintWindow);
+
+        if(pKnownTarget)
+        {
+            Region aOptimizedRepaintRegion = OptimizeDrawLayersRegion( pOut, rReg, bDisableIntersect );
+            pKnownTarget->GetPaintWindow().SetRedrawRegion(aOptimizedRepaintRegion);
+            mpPageView->setPreparedPageWindow(pKnownTarget); // already set actually
+        }
+    }
+}
+
+Region SdrPaintView::OptimizeDrawLayersRegion(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect)
+{
+    // #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
+    // rReg may be made more granular (fine) with using it. Normally, rReg
+    // does come from Window::Paint() anyways and thus is based on a single
+    // rectangle which was derived from exactly that repaint region
+    Region aOptimizedRepaintRegion(rReg);
+
+    // #i76114# Intersecting the region with the Window's paint region is disabled
+    // for print preview in Calc, because the intersection can be empty (if the paint
+    // region is outside of the table area of the page), and then no clip region
+    // would be set.
+    if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect)
+    {
+        Window* pWindow = (Window*)pOut;
+
+        if(pWindow->IsInPaint())
+        {
+            if(!pWindow->GetPaintRegion().IsEmpty())
+            {
+                aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
+
+#ifdef DBG_UTIL
+                // #i74769# test-paint repaint region
+                static bool bDoPaintForVisualControl(false);
+                if(bDoPaintForVisualControl)
+                {
+                    RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
+                    Rectangle aRegionRectangle;
+
+                    while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
+                    {
+                        pWindow->SetLineColor(COL_LIGHTGREEN);
+                        pWindow->SetFillColor();
+                        pWindow->DrawRect(aRegionRectangle);
+                    }
+
+                    aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
+                }
+#endif
+            }
+        }
+    }
+    return aOptimizedRepaintRegion;
+}
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 void SdrPaintView::ImpTextEditDrawing(SdrPaintWindow& rPaintWindow) const


More information about the Libreoffice-commits mailing list