diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-13 13:13:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-14 09:45:43 +0100 |
commit | 2e162bb1e8521ad8cd8148e0a18adc3eebadd710 (patch) | |
tree | ef32e07a607f627a1231d4fb634601efc951447a /svx | |
parent | 8960dae3a24f5dd2712f1fe74de0c3b22552b12b (diff) |
use cache value in ViewContact
Rely on the cached primitives without always rebuilding.
But only enable it for calc and draw right now, by adding a flag
at the SdrModel level.
Change-Id: I295e5a366b1b21d0f1561e6736bac919082afb5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128380
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/contact/viewcontact.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index bd79bc5ed4ac..55af6ab6cd4f 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -26,6 +26,8 @@ #include <drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx> #include <osl/diagnose.h> #include <tools/debug.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdmodel.hxx> namespace sdr::contact { @@ -184,6 +186,8 @@ void ViewContact::ActionChildInserted(ViewContact& rChild) // React on changes of the object of this ViewContact void ViewContact::ActionChanged() { + mxViewIndependentPrimitive2DSequence.clear(); // clear cache + // propagate change to all existing VOCs. This will invalidate // all drawn visualisations in all known views const sal_uInt32 nCount(maViewObjectContactVector.size()); @@ -229,6 +233,17 @@ void ViewContact::createViewIndependentPrimitive2DSequence( void ViewContact::getViewIndependentPrimitive2DContainer( drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const { + // only some of the top-level apps are any good at reliably invalidating us (e.g. writer is not) + if (SdrObject* pSdrObj = TryToGetSdrObject()) + if (pSdrObj->getSdrModelFromSdrObject().IsVOCInvalidationIsReliable()) + { + if (!mxViewIndependentPrimitive2DSequence.empty()) + { + rVisitor.visit(mxViewIndependentPrimitive2DSequence); + return; + } + } + /* Local up-to-date checks. Create new list and compare. We cannot just always use the new data because the old data has cached bitmaps in it e.g. see the document in tdf#146108. */ |