include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx |    2 +
 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx  |   21 +++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 32c8bd660e74169a17fdfd4cdbf42bb79dc5a10d
Author:     Mark Hung <mark...@gmail.com>
AuthorDate: Wed Mar 4 19:16:47 2020 +0800
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Mar 6 20:40:17 2020 +0100

    tdf#120216 improve svx table performance.
    
    By defining operator== for SdrConnectStyleData and
    SdrFrameBorderData, and make a deeper comparison instead
    of the pointer stored shared_ptr in SdrFrameBorderPrimitive2D.
    The SdrFrameBorderPrimitive2D::operator== always
    return false before. The response time of clicking a cell
    and then entering editing mode improved from 4s to 0.5s
    in my environment.
    
    Change-Id: I625d9f69a07f42cac4a6cba45ec9e1c4195b6d58
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90120
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx 
b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx
index b06b5f92d71e..82072669829d 100644
--- a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx
+++ b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx
@@ -54,6 +54,7 @@ namespace drawinglayer
                 const svx::frame::Style& getStyle() const { return maStyle; }
                 const basegfx::B2DVector& getNormalizedPerpendicular() const { 
return maNormalizedPerpendicular; }
                 bool getStyleMirrored() const { return  mbStyleMirrored; }
+                bool operator==(const SdrConnectStyleData& rCompare) const;
             };
 
             std::vector<SdrConnectStyleData>   maStart;
@@ -77,6 +78,7 @@ namespace drawinglayer
                 double fMinDiscreteUnit) const;
 
             double getMinimalNonZeroBorderWidth() const;
+            bool operator==(const SdrFrameBorderData& rCompare) const;
         };
 
         typedef std::vector<SdrFrameBorderData> SdrFrameBorderDataVector;
diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx 
b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
index c853da76ad11..3c131948579b 100644
--- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
@@ -654,6 +654,13 @@ namespace drawinglayer::primitive2d
         {
         }
 
+        bool SdrFrameBorderData::SdrConnectStyleData::operator==(const 
SdrFrameBorderData::SdrConnectStyleData& rCompare) const
+        {
+            return mbStyleMirrored == rCompare.mbStyleMirrored
+                && maStyle == rCompare.maStyle
+                && maNormalizedPerpendicular == 
rCompare.maNormalizedPerpendicular;
+        }
+
         SdrFrameBorderData::SdrFrameBorderData(
             const basegfx::B2DPoint& rOrigin,
             const basegfx::B2DVector& rX,
@@ -748,6 +755,16 @@ namespace drawinglayer::primitive2d
         }
 
 
+        bool SdrFrameBorderData::operator==(const SdrFrameBorderData& 
rCompare) const
+        {
+            return maOrigin == rCompare.maOrigin
+                && maX == rCompare.maX
+                && maStyle == rCompare.maStyle
+                && maColor == rCompare.maColor
+                && mbForceColor == rCompare.mbForceColor
+                && maStart == rCompare.maStart
+                && maEnd == rCompare.maEnd;
+        }
 
 
         void SdrFrameBorderPrimitive2D::create2DDecomposition(
@@ -860,7 +877,9 @@ namespace drawinglayer::primitive2d
             {
                 const SdrFrameBorderPrimitive2D& rCompare = static_cast<const 
SdrFrameBorderPrimitive2D&>(rPrimitive);
 
-                return getFrameBorders() == rCompare.getFrameBorders()
+                return (getFrameBorders() == rCompare.getFrameBorders()
+                    || (getFrameBorders() && rCompare.getFrameBorders()
+                        && *getFrameBorders() == *rCompare.getFrameBorders()))
                     && doForceToSingleDiscreteUnit() == 
rCompare.doForceToSingleDiscreteUnit();
             }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to