[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - include/svx svx/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 23 11:41:23 UTC 2021


 include/svx/sdr/contact/viewcontact.hxx |    3 +--
 svx/source/sdr/contact/viewcontact.cxx  |   30 +++++++++++++-----------------
 2 files changed, 14 insertions(+), 19 deletions(-)

New commits:
commit 7d0e88ce674a7e809352842bcce3cd67f548a524
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Apr 23 12:20:42 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Apr 23 13:40:50 2021 +0200

    Revert "tdf#130326 related, speed up drawing"
    
    This reverts commit 91385bbc7cccfdf59f60a24eaf81894772134af0.
    
    Reason for revert: had to be reverted in master because it caused a regression
    
    Change-Id: I8ec5e2df4f3b8154fa4dfca8f5bee62f6d731156
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114507
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Jenkins

diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx
index d5603790ffd0..c5cc61883a49 100644
--- a/include/svx/sdr/contact/viewcontact.hxx
+++ b/include/svx/sdr/contact/viewcontact.hxx
@@ -49,8 +49,7 @@ private:
     // Primitive2DContainer of the ViewContact. This contains all necessary information
     // for the graphical visualisation and needs to be supported by all VCs which
     // can be visualized.
-    mutable drawinglayer::primitive2d::Primitive2DContainer mxViewIndependentPrimitive2DSequence;
-    mutable bool mbNeedToCreatePrimitives;
+    drawinglayer::primitive2d::Primitive2DContainer mxViewIndependentPrimitive2DSequence;
 
     // A new ViewObjectContact was created and shall be remembered.
     void AddViewObjectContact(ViewObjectContact& rVOContact);
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
index 75c40cfb2cc4..8e8d35db4406 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -39,7 +39,6 @@ ViewObjectContact& ViewContact::CreateObjectSpecificViewObjectContact(ObjectCont
 ViewContact::ViewContact()
     : maViewObjectContactVector()
     , mxViewIndependentPrimitive2DSequence()
-    , mbNeedToCreatePrimitives(true)
 {
 }
 
@@ -62,7 +61,6 @@ void ViewContact::deleteAllVOCs()
 
     // assert when there were new entries added during deletion
     DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList in VC (!)");
-    mbNeedToCreatePrimitives = true;
 }
 
 // get an Object-specific ViewObjectContact for a specific
@@ -98,7 +96,6 @@ ViewObjectContact& ViewContact::GetViewObjectContact(ObjectContact& rObjectConta
 void ViewContact::AddViewObjectContact(ViewObjectContact& rVOContact)
 {
     maViewObjectContactVector.push_back(&rVOContact);
-    mbNeedToCreatePrimitives = true;
 }
 
 // A ViewObjectContact was deleted and shall be forgotten.
@@ -110,7 +107,6 @@ void ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
     if (aFindResult != maViewObjectContactVector.end())
     {
         maViewObjectContactVector.erase(aFindResult);
-        mbNeedToCreatePrimitives = true;
     }
 }
 
@@ -186,7 +182,6 @@ void ViewContact::ActionChildInserted(ViewContact& rChild)
         // rectangle will be invalidated at the associated OutputDevice.
         pCandidate->ActionChildInserted(rChild);
     }
-    mbNeedToCreatePrimitives = true;
 }
 
 // React on changes of the object of this ViewContact
@@ -204,7 +199,6 @@ void ViewContact::ActionChanged()
 
         pCandidate->ActionChanged();
     }
-    mbNeedToCreatePrimitives = true;
 }
 
 // access to SdrObject and/or SdrPage. May return 0L like the default
@@ -235,20 +229,22 @@ ViewContact::createViewIndependentPrimitive2DSequence() const
 drawinglayer::primitive2d::Primitive2DContainer const&
 ViewContact::getViewIndependentPrimitive2DContainer() const
 {
-    if (mbNeedToCreatePrimitives)
-    {
-        drawinglayer::primitive2d::Primitive2DContainer xNew(
-            createViewIndependentPrimitive2DSequence());
+    // local up-to-date checks. Create new list and compare.
+    drawinglayer::primitive2d::Primitive2DContainer xNew(
+        createViewIndependentPrimitive2DSequence());
 
-        if (!xNew.empty())
-        {
-            // allow evtl. embedding in object-specific infos, e.g. Name, Title, Description
-            xNew = embedToObjectSpecificInformation(std::move(xNew));
-        }
+    if (!xNew.empty())
+    {
+        // allow evtl. embedding in object-specific infos, e.g. Name, Title, Description
+        xNew = embedToObjectSpecificInformation(std::move(xNew));
+    }
 
-        mxViewIndependentPrimitive2DSequence = std::move(xNew);
-        mbNeedToCreatePrimitives = false;
+    if (mxViewIndependentPrimitive2DSequence != xNew)
+    {
+        // has changed, copy content
+        const_cast<ViewContact*>(this)->mxViewIndependentPrimitive2DSequence = std::move(xNew);
     }
+
     // return current Primitive2DContainer
     return mxViewIndependentPrimitive2DSequence;
 }


More information about the Libreoffice-commits mailing list