summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-17 14:29:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-17 16:48:50 +0200
commit7ef7a23e7ee1f59cf719618991b3028456d84cf8 (patch)
treeb76a85b1fed8e057a4df836a36d5c7c9c5807a17
parent398c13f84b1977acf2c63f2159cf0255b3494bdc (diff)
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 <noel.grandin@collabora.co.uk>
-rw-r--r--include/svx/sdr/contact/viewcontact.hxx3
-rw-r--r--svx/source/sdr/contact/viewcontact.cxx30
2 files changed, 14 insertions, 19 deletions
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;
}