[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/vcl vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 15:50:16 UTC 2019


 include/vcl/status.hxx       |    1 +
 vcl/source/window/status.cxx |   14 +++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 78400d8f0b3906f9835b0cbb70a907625f213ebf
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Nov 26 08:34:57 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 27 16:49:02 2019 +0100

    tdf#108642 rate-limit progress painting
    
    this takes the load time from 9s to 6s for me
    
    Change-Id: I1a492b33106e43b1405238fe3a120a6447649f69
    Reviewed-on: https://gerrit.libreoffice.org/83848
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 28ea418a3f1905d8a4a8e5813e8ed737960c62d2)
    Reviewed-on: https://gerrit.libreoffice.org/83885

diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index c67f54bfd792..169dfa5e7b15 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -79,6 +79,7 @@ private:
     sal_uInt16          mnCurItemId;
     sal_uInt16          mnPercent;
     sal_uInt16          mnPercentCount;
+    sal_uInt32          mnLastProgressPaint_ms;
     bool                mbFormat;
     bool                mbProgressMode;
     bool                mbInUserDraw;
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 92fb94d66587..8cc26fa95146 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -133,7 +133,8 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
 }
 
 StatusBar::StatusBar( vcl::Window* pParent, WinBits nStyle ) :
-    Window( WindowType::STATUSBAR )
+    Window( WindowType::STATUSBAR ),
+    mnLastProgressPaint_ms(osl_getGlobalTimer())
 {
     ImplInit( pParent, nStyle );
 }
@@ -1347,8 +1348,15 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
 
     if (bInvalidate)
     {
-        Invalidate(maPrgsFrameRect);
-        Update();
+        // Rate limit how often we paint, otherwise in some loading scenerios we can spend significant
+        // time just painting progress bars.
+        sal_uInt32 nTime_ms = osl_getGlobalTimer();
+        if ((nTime_ms - mnLastProgressPaint_ms) > 100)
+        {
+            Invalidate(maPrgsFrameRect);
+            Update();
+            mnLastProgressPaint_ms = nTime_ms;
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list