[Libreoffice-commits] core.git: sd/source

Mike Kaganski mike.kaganski at collabora.com
Tue Mar 20 09:44:27 UTC 2018


 sd/source/core/sdpage2.cxx |   46 +++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 18 deletions(-)

New commits:
commit 992a477840506c73495cabcebc9febd0cc9fe1c5
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Tue Mar 20 09:46:57 2018 +0100

    Speed up SdPage comparison
    
    Move trivial comparisons to front; return early on object comparison
    
    Change-Id: I4db927ac87dbb165e80b70046ff44a260b8a504b
    Reviewed-on: https://gerrit.libreoffice.org/51624
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index deab43fa74fa..61fd29db97f7 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -558,24 +558,34 @@ void SdPage::setTransitionDuration ( double fTranstionDuration )
 
 bool SdPage::Equals(const SdPage& rOtherPage) const
 {
-    bool isEqual = GetObjCount() == rOtherPage.GetObjCount();
-    if( isEqual )
-    {
-        for(size_t i = 0; i < GetObjCount(); ++i)
-            isEqual = isEqual && GetObj(i)->Equals(*(rOtherPage.GetObj(i)));
-    }
-
-    return (isEqual && mePageKind == rOtherPage.mePageKind && meAutoLayout == rOtherPage.meAutoLayout &&
-            mePresChange == rOtherPage.mePresChange && rtl::math::approxEqual(mfTime, rOtherPage.mfTime) &&
-            mbSoundOn == rOtherPage.mbSoundOn && mbExcluded == rOtherPage.mbExcluded &&
-            maLayoutName == rOtherPage.maLayoutName && maSoundFile == rOtherPage.maSoundFile &&
-            mbLoopSound == rOtherPage.mbLoopSound && mbStopSound == rOtherPage.mbStopSound &&
-            maBookmarkName == rOtherPage.maBookmarkName && mbScaleObjects == rOtherPage.mbScaleObjects &&
-            mbBackgroundFullSize == rOtherPage.mbBackgroundFullSize && meCharSet == rOtherPage.meCharSet &&
-            mnPaperBin == rOtherPage.mnPaperBin && mnTransitionType == rOtherPage.mnTransitionType &&
-            mnTransitionSubtype == rOtherPage.mnTransitionSubtype && mbTransitionDirection == rOtherPage.mbTransitionDirection &&
-            mnTransitionFadeColor == rOtherPage.mnTransitionFadeColor &&
-            rtl::math::approxEqual(mfTransitionDuration, rOtherPage.mfTransitionDuration));
+    if (GetObjCount() != rOtherPage.GetObjCount() ||
+        mePageKind != rOtherPage.mePageKind ||
+        meAutoLayout != rOtherPage.meAutoLayout ||
+        mePresChange != rOtherPage.mePresChange ||
+        !rtl::math::approxEqual(mfTime, rOtherPage.mfTime) ||
+        mbSoundOn != rOtherPage.mbSoundOn ||
+        mbExcluded != rOtherPage.mbExcluded ||
+        maLayoutName != rOtherPage.maLayoutName ||
+        maSoundFile != rOtherPage.maSoundFile ||
+        mbLoopSound != rOtherPage.mbLoopSound ||
+        mbStopSound != rOtherPage.mbStopSound ||
+        maBookmarkName != rOtherPage.maBookmarkName ||
+        mbScaleObjects != rOtherPage.mbScaleObjects ||
+        mbBackgroundFullSize != rOtherPage.mbBackgroundFullSize ||
+        meCharSet != rOtherPage.meCharSet ||
+        mnPaperBin != rOtherPage.mnPaperBin ||
+        mnTransitionType != rOtherPage.mnTransitionType ||
+        mnTransitionSubtype != rOtherPage.mnTransitionSubtype ||
+        mbTransitionDirection != rOtherPage.mbTransitionDirection ||
+        mnTransitionFadeColor != rOtherPage.mnTransitionFadeColor ||
+        !rtl::math::approxEqual(mfTransitionDuration, rOtherPage.mfTransitionDuration))
+        return false;
+
+    for(size_t i = 0; i < GetObjCount(); ++i)
+        if (!GetObj(i)->Equals(*(rOtherPage.GetObj(i))))
+            return false;
+
+    return true;
  }
 
 void SdPage::createAnnotation( css::uno::Reference< css::office::XAnnotation >& xAnnotation )


More information about the Libreoffice-commits mailing list