From ef4964a4e598c3c9714cdc18ffa40bcb120dbef6 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Tue, 26 May 2020 12:29:37 +0200 Subject: reduce dynamic_cast usage in an O(N^2) algorithm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When scrolling down in tdf#130431 this is the major CPU cost. Move the dynamic_cast out of the loops as much as possible. Change-Id: I0ea9f457bb17fbdde880f09b059f07dec4b1790b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94858 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- include/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include/drawinglayer') diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 1a3bfa2b1b9b..537f503e5b9b 100644 --- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -81,12 +81,6 @@ public: bool operator==(const BorderLine& rBorderLine) const; }; -/// helper to try to merge two instances of BorderLinePrimitive2D. If it was possible, -/// a merged version is in the returned Primitive2DReference. Lots of preconditions -/// have to be met to allow that, see implementation (and maybe even expand) -Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D( - const Primitive2DReference& rCandidateA, const Primitive2DReference& rCandidateB); - /** BorderLinePrimitive2D class This is the basic primitive to build frames around objects, e.g. tables. @@ -141,6 +135,12 @@ public: virtual sal_uInt32 getPrimitive2DID() const override; }; +/// helper to try to merge two instances of BorderLinePrimitive2D. If it was possible, +/// a merged version is in the returned Primitive2DReference. Lots of preconditions +/// have to be met to allow that, see implementation (and maybe even expand) +Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D( + const BorderLinePrimitive2D* pCandidateA, const BorderLinePrimitive2D* pCandidateB); + } // end of namespace drawinglayer::primitive2d /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit