From 7ef7a23e7ee1f59cf719618991b3028456d84cf8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 17 Apr 2021 14:29:55 +0200 Subject: tdf#141675 Incorrect position of shape This reverts commit 44711d9eb53eb6247ebdb9293a3eb5e643f78059 tdf#130326 related, speed up drawing because it causes a regression. Change-Id: I19ea236b8541c1fe2557f43375bfef3ba555cfff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114183 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/sdr/contact/viewcontact.cxx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'svx') 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(this)->mxViewIndependentPrimitive2DSequence = std::move(xNew); } + // return current Primitive2DContainer return mxViewIndependentPrimitive2DSequence; } -- cgit