diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-11-13 09:56:53 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-11-13 14:03:31 +0000 |
commit | 12dcf5e6e770b1933252a1f919663ba45ded4cdf (patch) | |
tree | 2b084a51384735ec383cf52d7c6d72a13ac90eff /sd | |
parent | ea6857f86b444fe7f87e74c41dbfe9ba8c02f942 (diff) |
slideshow: cleanup main-loop usage, post-yield listeners, etc.
This removes several attempts at reducing jitter in slideshow
animations. Now we have high-resolution (ie. not clamped to 10ms)
timers on Windows and a cleaner and simpler main-loop, we should
be able to use generic timer code-paths for all of this.
This also allows us to further cleanup and simplify the main-loop
removing the now redundent post-yield handler concept. If there is a
short enough timeout, we will take just 1ms of delay before executing
a short timer anyway.
Also removed some lingering comments from an old attempt to boost
priorities which broken audio playback.
Tested: tdf#32861 - still works, audio still plays, no new jitter
in animations that I tested.
Change-Id: Iadc5e2a48828a18a599a86a8df14cb2b75dd425e
Reviewed-on: https://gerrit.libreoffice.org/19947
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 45 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.hxx | 3 |
2 files changed, 6 insertions, 42 deletions
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 5fadc3d57f88..a9fe9f8c61f7 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -746,9 +746,6 @@ void SAL_CALL SlideshowImpl::disposing() setActiveXToolbarsVisible( true ); - Application::DisableNoYieldMode(); - Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); - mbDisposed = true; } @@ -1788,22 +1785,6 @@ IMPL_LINK_NOARG_TYPED(SlideshowImpl, updateHdl, Timer *, void) updateSlideShow(); } -IMPL_LINK_NOARG_TYPED(SlideshowImpl, PostYieldListener, LinkParamNone*, void) -{ - // prevent me from deletion when recursing (App::Reschedule does) - const rtl::Reference<SlideshowImpl> this_(this); - - Application::DisableNoYieldMode(); - Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); - Application::Reschedule(true); // fix for fdo#32861 - process - // *all* outstanding events after - // yield is done. - if (mbDisposed) - return; - Application::Reschedule(true); - updateSlideShow(); -} - sal_Int32 SlideshowImpl::updateSlideShow() { // prevent me from deletion when recursing (App::EnableYieldMode does) @@ -1815,26 +1796,13 @@ sal_Int32 SlideshowImpl::updateSlideShow() try { - // TODO(Q3): Evaluate under various systems and setups, - // whether this is really necessary. Under WinXP and Matrox - // G550, the frame rates were much more steadier with this - // tweak, although. - - // currently no solution, because this kills sound (at least on Windows) - double fUpdate = 0.0; if( !xShow->update(fUpdate) ) fUpdate = -1.0; if (mxShow.is() && (fUpdate >= 0.0)) { - if (::basegfx::fTools::equalZero(fUpdate)) - { - // Use post yield listener for short update intervalls. - Application::EnableNoYieldMode(); - Application::AddPostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); - } - else + if (!::basegfx::fTools::equalZero(fUpdate)) { // Avoid busy loop when the previous call to update() // returns a small positive number but not 0 (which is @@ -1851,14 +1819,11 @@ sal_Int32 SlideshowImpl::updateSlideShow() // too high (only then conversion to milliseconds and long // integer may lead to zero value.) OSL_ASSERT(static_cast<sal_uLong>(fUpdate * 1000.0) > 0); - - Application::DisableNoYieldMode(); - Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener)); - - // Use a timer for the asynchronous callback. - maUpdateTimer.SetTimeout(static_cast<sal_uLong>(fUpdate * 1000.0)); - maUpdateTimer.Start(); } + + // Use our high resolution timers for the asynchronous callback. + maUpdateTimer.SetTimeout(static_cast<sal_uLong>(fUpdate * 1000.0)); + maUpdateTimer.Start(); } } catch( Exception& ) diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 90d846d7058e..cf95f3276978 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -275,7 +275,6 @@ private: void setActiveXToolbarsVisible( bool bVisible ); DECL_LINK_TYPED( updateHdl, Timer *, void ); - DECL_LINK_TYPED( PostYieldListener, LinkParamNone*, void ); DECL_LINK_TYPED( ReadyForNextInputHdl, Timer *, void ); DECL_LINK_TYPED( endPresentationHdl, void*, void ); DECL_LINK_TYPED( ContextMenuSelectHdl, Menu *, bool ); @@ -311,7 +310,7 @@ private: static void setAutoSaveState( bool bOn ); void gotoPreviousSlide (const bool bSkipAllMainSequenceEffects); - /** Called by PostYieldListener and updateHdl handlers this method is + /** Called by our maUpdateTimer's updateHdl handler this method is responsible to call the slideshow update() method and, depending on its return value, wait for a certain amount of time before another call to update() is scheduled. |