[Libreoffice-commits] core.git: svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 22 10:41:06 UTC 2021
svx/source/sdr/contact/viewobjectcontact.cxx | 70 +++++++++++++--------------
1 file changed, 35 insertions(+), 35 deletions(-)
New commits:
commit 43f77f1f86ecb7d28095989eabf5febc7ace8a9a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Apr 22 10:22:35 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Apr 22 12:40:29 2021 +0200
std::move optimisation
avoid copying the old list to the new list and destroying both, reduces
time rendering complex spreadsheets
Change-Id: I1454cb16f418691743d212a17167c53fbe19ce4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114469
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
index 6387c39afcbf..e65c2bab1d6e 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -346,45 +346,45 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewObjectContact::getPr
}
// local up-to-date checks. New list different from local one?
- if(mxPrimitive2DSequence != xNewPrimitiveSequence)
- {
- // has changed, copy content
- const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = xNewPrimitiveSequence;
+ if(mxPrimitive2DSequence == xNewPrimitiveSequence)
+ return mxPrimitive2DSequence;
- // check for animated stuff
- const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations();
+ // has changed, copy content
+ const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = std::move(xNewPrimitiveSequence);
- // always update object range when PrimitiveSequence changes
- const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
- const_cast< ViewObjectContact* >(this)->maObjectRange = mxPrimitive2DSequence.getB2DRange(rViewInformation2D);
+ // check for animated stuff
+ const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations();
- // check and eventually embed to GridOffset transform primitive
- if(GetObjectContact().supportsGridOffsets())
- {
- const basegfx::B2DVector& rGridOffset(getGridOffset());
+ // always update object range when PrimitiveSequence changes
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const_cast< ViewObjectContact* >(this)->maObjectRange = mxPrimitive2DSequence.getB2DRange(rViewInformation2D);
- if(0.0 != rGridOffset.getX() || 0.0 != rGridOffset.getY())
- {
- const basegfx::B2DHomMatrix aTranslateGridOffset(
- basegfx::utils::createTranslateB2DHomMatrix(
- rGridOffset));
- const drawinglayer::primitive2d::Primitive2DReference aEmbed(
- new drawinglayer::primitive2d::TransformPrimitive2D(
- aTranslateGridOffset,
- mxPrimitive2DSequence));
-
- // Set values at local data. So for now, the mechanism is to reset some of the
- // defining things (mxPrimitive2DSequence, maGridOffset) and re-create the
- // buffered data (including maObjectRange). It *could* be changed to keep
- // the unmodified PrimitiveSequence and only update the GridOffset, but this
- // would require a 2nd instance of maObjectRange and mxPrimitive2DSequence. I
- // started doing so, but it just makes the code more complicated. For now,
- // 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 };
- const_cast< ViewObjectContact* >(this)->maObjectRange.transform(aTranslateGridOffset);
- }
+ // check and eventually embed to GridOffset transform primitive
+ if(GetObjectContact().supportsGridOffsets())
+ {
+ const basegfx::B2DVector& rGridOffset(getGridOffset());
+
+ if(0.0 != rGridOffset.getX() || 0.0 != rGridOffset.getY())
+ {
+ const basegfx::B2DHomMatrix aTranslateGridOffset(
+ basegfx::utils::createTranslateB2DHomMatrix(
+ rGridOffset));
+ const drawinglayer::primitive2d::Primitive2DReference aEmbed(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ aTranslateGridOffset,
+ mxPrimitive2DSequence));
+
+ // Set values at local data. So for now, the mechanism is to reset some of the
+ // defining things (mxPrimitive2DSequence, maGridOffset) and re-create the
+ // buffered data (including maObjectRange). It *could* be changed to keep
+ // the unmodified PrimitiveSequence and only update the GridOffset, but this
+ // would require a 2nd instance of maObjectRange and mxPrimitive2DSequence. I
+ // started doing so, but it just makes the code more complicated. For now,
+ // 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 };
+ const_cast< ViewObjectContact* >(this)->maObjectRange.transform(aTranslateGridOffset);
}
}
More information about the Libreoffice-commits
mailing list