From 3e0092031b73bad107e3122d5d4be2f5bd487744 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 5 Apr 2019 10:44:16 +0200 Subject: tdf#112318 sd opengl: fix lack of initial animation Commit 881043d1f01fad663c0a17f11cbe2dab79e31217 (#i98792# Allow frequent calls to slide show update()., 2009-04-27) added a comment in sd::SlideshowImpl::updateSlideShow() talking about an "above" case, when the slideshow update suggests to not wait till the next update, but later commit 12dcf5e6e770b1933252a1f919663ba45ded4cdf (slideshow: cleanup main-loop usage, post-yield listeners, etc., 2015-11-13) removed that handling. That was fine till opengl rendering was introduced, which swaps its backbuffer in an idle handler. Given that OpenGLFlushIdle's priority is TaskPriority::POST_PAINT and SlideshowImpl::maUpdateTimer's priority is TaskPriority::REPAINT, the GL backbuffer is not always painted while an animation is ongoing. This is more visible when tweaking the bugdoc to have an e.g. 5 sec animation, then starting the slideshow results in waiting for 5 seconds and only then the slide shows up, without an animation. Fix the problem by re-introducing the handling of the fUpdate == 0, and processing idle events there, which means the GL backbuffer will be always painted, regardless if fUpdate is a small number or 0. Change-Id: I25b2dc0aa41af62d9bd89617178eb2e9997f5b17 Reviewed-on: https://gerrit.libreoffice.org/70287 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sd/source/ui/slideshow/slideshowimpl.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sd') diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 83d594415b2d..2cbc9e0a67d1 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -74,6 +74,7 @@ #include #include #include +#include #include #include @@ -1695,7 +1696,12 @@ void SlideshowImpl::updateSlideShow() if (mxShow.is() && (fUpdate >= 0.0)) { - if (!::basegfx::fTools::equalZero(fUpdate)) + if (::basegfx::fTools::equalZero(fUpdate)) + { + // Make sure idle tasks don't starve when we don't have to wait. + Scheduler::ProcessEventsToIdle(); + } + else { // Avoid busy loop when the previous call to update() // returns a small positive number but not 0 (which is -- cgit