summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-11-26 08:34:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-27 07:44:54 +0100
commit28ea418a3f1905d8a4a8e5813e8ed737960c62d2 (patch)
tree422b9b00db9d1e9fafeb3f25ec79dc992fcf2ca0
parent4edf078a77167d0fb5201f857146d95a901a809e (diff)
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@collabora.co.uk>
-rw-r--r--include/vcl/status.hxx1
-rw-r--r--vcl/source/window/status.cxx14
2 files changed, 12 insertions, 3 deletions
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;
+ }
}
}