include/vcl/status.hxx | 1 + vcl/source/window/status.cxx | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
New commits: commit 28ea418a3f1905d8a4a8e5813e8ed737960c62d2 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 26 08:34:57 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Nov 27 07:44:54 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.gran...@collabora.co.uk> 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; + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits