summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-04-23 12:20:42 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-04-23 13:40:50 +0200
commit7d0e88ce674a7e809352842bcce3cd67f548a524 (patch)
tree3ac88008fda0591d02e497862b914eec32c8b794
parent91385bbc7cccfdf59f60a24eaf81894772134af0 (diff)
Revert "tdf#130326 related, speed up drawing"
This reverts commit 91385bbc7cccfdf59f60a24eaf81894772134af0. Reason for revert: had to be reverted in master because it caused a regression Change-Id: I8ec5e2df4f3b8154fa4dfca8f5bee62f6d731156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114507 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins
-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;
}