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

Miklos Vajna vmiklos at collabora.co.uk
Thu Mar 20 03:23:56 PDT 2014


 svx/source/sdr/contact/objectcontactofpageview.cxx |   27 ++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 465730622e2eb77828c1cf4845f8e8a40b92f1b2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Mar 20 11:01:59 2014 +0100

    svx: speed up ObjectContactOfPageView in case there is nothing to display
    
    Reviewed on:
    	https://gerrit.libreoffice.org/8675
    
    Change-Id: I8d797acb3ca9e2341c5db08b2fc409a3cd97635e

diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index e5f0b7a..ff31f90 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -233,9 +233,30 @@ namespace sdr
                 uno::Sequence<beans::PropertyValue>());
             updateViewInformation2D(aNewViewInformation2D);
 
-            // get whole Primitive2DSequence; this will already make use of updated ViewInformation2D
-            // and may use the MapMode from the Target OutDev in the DisplayInfo
-            drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence(rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
+            drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence;
+            // Only get the expensive hierarchy if we can be sure that the
+            // returned sequence won't be empty anyway.
+            bool bGetHierarchy = rRedrawArea.IsEmpty();
+            if (!bGetHierarchy)
+            {
+                // Not empty? Then not doing a full redraw, check if
+                // getPrimitive2DSequenceHierarchy() is still needed.
+                sal_Int32 nObjCount = GetSdrPage()->GetObjCount();
+                for (sal_Int32 i = 0; i < nObjCount; ++i)
+                {
+                    SdrObject* pObject = GetSdrPage()->GetObj(i);
+                    if (rRedrawArea.IsOver(pObject->GetCurrentBoundRect()))
+                    {
+                        bGetHierarchy = true;
+                        break;
+                    }
+                }
+            }
+
+            if (bGetHierarchy)
+                // get whole Primitive2DSequence; this will already make use of updated ViewInformation2D
+                // and may use the MapMode from the Target OutDev in the DisplayInfo
+                xPrimitiveSequence = rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo);
 
             // if there is something to show, use a primitive processor to render it. There
             // is a choice between VCL and Canvas processors currently. The decision is made in


More information about the Libreoffice-commits mailing list