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>
diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx
index d560379..c5cc618 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 75c40cf..8e8d35d 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)
// local up-to-date checks. Create new list and compare.
drawinglayer::primitive2d::Primitive2DContainer xNew(
createViewIndependentPrimitive2DSequence());
if (!xNew.empty())
{
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));
}
mxViewIndependentPrimitive2DSequence = std::move(xNew);
mbNeedToCreatePrimitives = false;
// allow evtl. embedding in object-specific infos, e.g. Name, Title, Description
xNew = embedToObjectSpecificInformation(std::move(xNew));
}
if (mxViewIndependentPrimitive2DSequence != xNew)
{
// has changed, copy content
const_cast<ViewContact*>(this)->mxViewIndependentPrimitive2DSequence = std::move(xNew);
}
// return current Primitive2DContainer
return mxViewIndependentPrimitive2DSequence;
}