diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-02 14:42:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-03 10:46:56 +0100 |
commit | 7f02cb80ac2075b65ee1adee4e29d1d5c4819424 (patch) | |
tree | 709c0cac2c68e3d4e71370956762db19c2153c3f | |
parent | 3337d210f3121559afc3574a41d821bb2283d773 (diff) |
lose the caching in ViewObjectContact
we reload the data every time anyway, so the caching is useless
Change-Id: I575cc2fbe5a2fe9f42c58894f471cabb842cdd46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126273
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/sdr/contact/viewobjectcontact.hxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontact.cxx | 26 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 6 |
3 files changed, 11 insertions, 33 deletions
diff --git a/include/svx/sdr/contact/viewobjectcontact.hxx b/include/svx/sdr/contact/viewobjectcontact.hxx index 453cfb2d90ea..de80fec63ef8 100644 --- a/include/svx/sdr/contact/viewobjectcontact.hxx +++ b/include/svx/sdr/contact/viewobjectcontact.hxx @@ -48,11 +48,6 @@ private: // This range defines the object's BoundRect basegfx::B2DRange maObjectRange; - // PrimitiveSequence of the ViewContact. This contains all necessary information - // for the graphical visualisation and needs to be supported by all VCs which - // can be visualized. - drawinglayer::primitive2d::Primitive2DContainer mxPrimitive2DSequence; - // the PrimitiveAnimation if Primitive2DContainer contains animations std::unique_ptr<sdr::animation::PrimitiveAnimation> mpPrimitiveAnimation; @@ -69,7 +64,7 @@ protected: // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation // and setup accordingly - void checkForPrimitive2DAnimations(); + void checkForPrimitive2DAnimations(const drawinglayer::primitive2d::Primitive2DContainer& ); // This method is responsible for creating the graphical visualisation data which is // stored/cached in the local primitive. Default gets view-independent Primitive @@ -78,9 +73,6 @@ protected: // This method will not handle included hierarchies and not check geometric visibility. virtual drawinglayer::primitive2d::Primitive2DContainer createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; - // method for flushing Primitive2DContainer for VOC implementations - void flushPrimitive2DSequence() { mxPrimitive2DSequence.clear(); } - public: // basic constructor. ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact); @@ -111,7 +103,7 @@ public: // access to the local primitive. This will ensure that the local primitive is // current in comparing the local one with a fresh created incarnation // This method will not handle included hierarchies and not check visibility. - drawinglayer::primitive2d::Primitive2DContainer const & getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; + drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const; // test this VOC for visibility concerning model-view stuff like e.g. Layer virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 23ee410628ab..f2baca7e5e73 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -263,13 +263,13 @@ void ViewObjectContact::ActionChildInserted(ViewContact& rChild) // GetObjectContact().InvalidatePartOfView(rChildVOC.getObjectRange()); } -void ViewObjectContact::checkForPrimitive2DAnimations() +void ViewObjectContact::checkForPrimitive2DAnimations(const drawinglayer::primitive2d::Primitive2DContainer& xPrimitive2DSequence) { // remove old one mpPrimitiveAnimation.reset(); // check for animated primitives - if(mxPrimitive2DSequence.empty()) + if(xPrimitive2DSequence.empty()) return; const bool bTextAnimationAllowed(GetObjectContact().IsTextAnimationAllowed()); @@ -279,7 +279,7 @@ void ViewObjectContact::checkForPrimitive2DAnimations() { AnimatedExtractingProcessor2D aAnimatedExtractor(GetObjectContact().getViewInformation2D(), bTextAnimationAllowed, bGraphicAnimationAllowed); - aAnimatedExtractor.process(mxPrimitive2DSequence); + aAnimatedExtractor.process(xPrimitive2DSequence); if(!aAnimatedExtractor.getPrimitive2DSequence().empty()) { @@ -327,7 +327,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::createPrimiti return xRetval; } -drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const +drawinglayer::primitive2d::Primitive2DContainer ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const { drawinglayer::primitive2d::Primitive2DContainer xNewPrimitiveSequence; @@ -343,19 +343,12 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr xNewPrimitiveSequence = createPrimitive2DSequence(rDisplayInfo); } - // local up-to-date checks. New list different from local one? - if(mxPrimitive2DSequence == xNewPrimitiveSequence) - return mxPrimitive2DSequence; - - // has changed, copy content - const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = std::move(xNewPrimitiveSequence); - // check for animated stuff - const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations(); + const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations(xNewPrimitiveSequence); // always update object range when PrimitiveSequence changes const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); - const_cast< ViewObjectContact* >(this)->maObjectRange = mxPrimitive2DSequence.getB2DRange(rViewInformation2D); + const_cast< ViewObjectContact* >(this)->maObjectRange = xNewPrimitiveSequence.getB2DRange(rViewInformation2D); // check and eventually embed to GridOffset transform primitive if(GetObjectContact().supportsGridOffsets()) @@ -370,7 +363,7 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr drawinglayer::primitive2d::Primitive2DReference aEmbed( new drawinglayer::primitive2d::TransformPrimitive2D( aTranslateGridOffset, - std::move(const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence))); + std::move(xNewPrimitiveSequence))); // Set values at local data. So for now, the mechanism is to reset some of the // defining things (mxPrimitive2DSequence, maGridOffset) and re-create the @@ -381,13 +374,13 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr // just allow re-creation of the PrimitiveSequence (and removing buffered // decomposed content of it). May be optimized, though. OTOH it only happens // in calc which traditionally does not have a huge amount of DrawObjects anyways. - const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = drawinglayer::primitive2d::Primitive2DContainer { aEmbed }; + xNewPrimitiveSequence = drawinglayer::primitive2d::Primitive2DContainer { aEmbed }; const_cast< ViewObjectContact* >(this)->maObjectRange.transform(aTranslateGridOffset); } } // return current Primitive2DContainer - return mxPrimitive2DSequence; + return xNewPrimitiveSequence; } bool ViewObjectContact::isPrimitiveVisible(const DisplayInfo& /*rDisplayInfo*/) const @@ -458,7 +451,6 @@ void ViewObjectContact::resetGridOffset() maGridOffset.setY(0.0); // also reset sequence to get a re-calculation when GridOffset changes - mxPrimitive2DSequence.clear(); maObjectRange.reset(); } diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 4f186b4d9072..8814ab54a596 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1749,12 +1749,6 @@ namespace sdr::contact { { // graphical invalidate at all views ActionChanged(); - - // #i93318# flush Primitive2DContainer to force recreation with updated XControlModel - // since e.g. background color has changed and existing decompositions are possibly no - // longer valid. Unfortunately this is not detected from ControlPrimitive2D::operator== - // since it only has a uno reference to the XControlModel - flushPrimitive2DSequence(); } UnoControlPrintOrPreviewContact::UnoControlPrintOrPreviewContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact ) |