include/svx/sdr/contact/viewobjectcontact.hxx |    3 --
 svx/source/sdr/contact/viewobjectcontact.cxx  |   27 +++++---------------------
 2 files changed, 6 insertions(+), 24 deletions(-)

New commits:
commit 5e6d6be86bf29896e030af5c0f770f2b389d7e8a
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Dec 23 21:45:19 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Dec 24 08:21:18 2021 +0100

    tdf#146132 tdf#146327 tdf#146330
    
    regression from
        commit fe6a140a537eda1b6703c44ff5ee49d2ba875b81
        Author: Noel Grandin <noel.gran...@collabora.co.uk>
        Date:   Tue Dec 7 14:55:13 2021 +0200
        used cache value in ViewObjectContact::getPrimitive2DSequence
    
    Unfortunately various things like scrolling/zooming/moving item
    to new page do not seem to invalidate the VOC, and I can't
    track down the right place to do that, so just revert.
    
    Change-Id: I8009c99417f634b26adc770b6d6d2eb6969d9629
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127389
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx 
b/include/svx/sdr/contact/viewobjectcontact.hxx
index 1be4cac81052..f13f247e55c2 100644
--- a/include/svx/sdr/contact/viewobjectcontact.hxx
+++ b/include/svx/sdr/contact/viewobjectcontact.hxx
@@ -59,9 +59,6 @@ private:
     // possible on-demand calculated GridOffset for non-linear ViewToDevice 
transformation (calc)
     basegfx::B2DVector                              maGridOffset;
 
-    // used to detect ActionChanged() during primitive construction
-    int                                             mnActionChangedCount;
-
     // This bool gets set when the object gets invalidated by ActionChanged() 
and
     // can be used from the OC to late-invalidates
     bool                                            mbLazyInvalidate : 1;
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx 
b/svx/source/sdr/contact/viewobjectcontact.cxx
index 79b2d03e625c..1dd8fef29415 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -147,7 +147,6 @@ ViewObjectContact::ViewObjectContact(ObjectContact& 
rObjectContact, ViewContact&
 :   mrObjectContact(rObjectContact),
     mrViewContact(rViewContact),
     maGridOffset(0.0, 0.0),
-    mnActionChangedCount(0),
     mbLazyInvalidate(false)
 {
     // make the ViewContact remember me
@@ -194,7 +193,7 @@ const basegfx::B2DRange& 
ViewObjectContact::getObjectRange() const
         {
             // if range is not computed (new or LazyInvalidate objects), force 
it
             const DisplayInfo aDisplayInfo;
-            const drawinglayer::primitive2d::Primitive2DContainer& 
xSequence(getPrimitive2DSequence(aDisplayInfo));
+            const drawinglayer::primitive2d::Primitive2DContainer 
xSequence(getPrimitive2DSequence(aDisplayInfo));
 
             if(!xSequence.empty())
             {
@@ -209,10 +208,6 @@ const basegfx::B2DRange& 
ViewObjectContact::getObjectRange() const
 
 void ViewObjectContact::ActionChanged()
 {
-    // clear cached primitives
-    mxPrimitive2DSequence.clear();
-    ++mnActionChangedCount;
-
     if(mbLazyInvalidate)
         return;
 
@@ -335,9 +330,6 @@ void ViewObjectContact::createPrimitive2DSequence(const 
DisplayInfo& rDisplayInf
 
 drawinglayer::primitive2d::Primitive2DContainer const & 
ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
 {
-    if (!mxPrimitive2DSequence.empty())
-        return mxPrimitive2DSequence;
-
     /**
     This method is weird because
     (1) we have to re-walk the primitive tree because the flushing is 
unreliable
@@ -423,28 +415,21 @@ void 
ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInf
     if(!isPrimitiveVisible(rDisplayInfo))
         return;
 
-    getPrimitive2DSequence(rDisplayInfo);
-    if(mxPrimitive2DSequence.empty())
+    drawinglayer::primitive2d::Primitive2DContainer xRetval = 
getPrimitive2DSequence(rDisplayInfo);
+    if(xRetval.empty())
         return;
 
     // get ranges
     const drawinglayer::geometry::ViewInformation2D& 
rViewInformation2D(GetObjectContact().getViewInformation2D());
+    const basegfx::B2DRange 
aObjectRange(xRetval.getB2DRange(rViewInformation2D));
     const basegfx::B2DRange& aViewRange(rViewInformation2D.getViewport());
 
     // check geometrical visibility
-    bool bVisible = aViewRange.isEmpty() || aViewRange.overlaps(maObjectRange);
+    bool bVisible = aViewRange.isEmpty() || aViewRange.overlaps(aObjectRange);
     if(!bVisible)
         return;
 
-    // temporarily take over the mxPrimitive2DSequence, in case it gets 
invalidated while we want to iterate over it
-    auto tmp = 
std::move(const_cast<ViewObjectContact*>(this)->mxPrimitive2DSequence);
-    int nPrevCount = mnActionChangedCount;
-
-    rVisitor.visit(tmp);
-
-    // if we received ActionChanged() calls while walking the primitives, then 
leave it empty, otherwise move it back
-    if (mnActionChangedCount == nPrevCount)
-        const_cast<ViewObjectContact*>(this)->mxPrimitive2DSequence = 
std::move(tmp);
+    rVisitor.visit(std::move(xRetval));
 }
 
 void ViewObjectContact::getPrimitive2DSequenceSubHierarchy(DisplayInfo& 
rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor& 
rVisitor) const

Reply via email to