include/svx/sdr/contact/viewcontact.hxx |    5 +++++
 svx/source/sdr/contact/viewcontact.cxx  |   14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 26259e4089ec0225e84ed99159d85e858f612022
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Dec 8 11:14:47 2021 +0200
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Dec 10 22:53:09 2021 +0100

    tdf#146108 Calc slow to change cell focus..
    
    in a document with a big background image
    
    Revert "tdf#136058: remove some caching"
    This reverts commit 57c40329a2b469813a1f357de355a37c8e3077ae.
    
    And add some comments for future would-be optimisers.
    
    Change-Id: Ie8686edc38dcdbe7d9e78599c1a259aab68278a1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126527
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126574
    (cherry picked from commit 585bf5f2b223a1449dd8f6b65c5f0c0c00160af7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126598
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/include/svx/sdr/contact/viewcontact.hxx 
b/include/svx/sdr/contact/viewcontact.hxx
index c7119fcd93e2..eee3ea6f11cb 100644
--- a/include/svx/sdr/contact/viewcontact.hxx
+++ b/include/svx/sdr/contact/viewcontact.hxx
@@ -46,6 +46,11 @@ private:
     // Registering and de-registering is done in the VOC 
constructors/destructors.
     std::vector<ViewObjectContact*> maViewObjectContactVector;
 
+    // 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.
+    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 1723a6bb91e8..52cca39d7057 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -104,7 +104,9 @@ void 
ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
         maViewObjectContactVector.begin(), maViewObjectContactVector.end(), 
&rVOContact);
 
     if (aFindResult != maViewObjectContactVector.end())
+    {
         maViewObjectContactVector.erase(aFindResult);
+    }
 }
 
 // Test if this ViewContact has ViewObjectContacts at all. This can
@@ -229,6 +231,9 @@ ViewContact::createViewIndependentPrimitive2DSequence() 
const
 drawinglayer::primitive2d::Primitive2DContainer
 ViewContact::getViewIndependentPrimitive2DContainer() const
 {
+    /* Local up-to-date checks. Create new list and compare.
+        We cannot just always use the new data because the old data has cached 
bitmaps in it e.g. see the document in tdf#146108.
+    */
     drawinglayer::primitive2d::Primitive2DContainer xNew(
         createViewIndependentPrimitive2DSequence());
 
@@ -238,7 +243,14 @@ ViewContact::getViewIndependentPrimitive2DContainer() const
         xNew = embedToObjectSpecificInformation(std::move(xNew));
     }
 
-    return xNew;
+    if (mxViewIndependentPrimitive2DSequence != xNew)
+    {
+        // has changed, copy content
+        const_cast<ViewContact*>(this)->mxViewIndependentPrimitive2DSequence = 
std::move(xNew);
+    }
+
+    // return current Primitive2DContainer
+    return mxViewIndependentPrimitive2DSequence;
 }
 
 // add Gluepoints (if available)

Reply via email to