From 309c5f45da9fe4972b105c7c27d2ee14ff109dcc Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Thu, 10 Mar 2005 11:11:35 +0000 Subject: [PATCH] INTEGRATION: CWS presfixes01 (1.5.6); FILE MERGED 2005/03/09 08:40:11 fs 1.5.6.10: RESYNC: (1.9-1.12); FILE MERGED 2005/02/25 12:29:21 dbo 1.5.6.9: #i12423# don't modify thread prio, because this most often kills sound (at least on Windows) Issue number: Submitted by: Reviewed by: 2005/02/19 23:53:56 thb 1.5.6.8: RESYNC: (1.5-1.9); FILE MERGED 2005/02/16 11:16:17 fs 1.5.6.7: #i42558# drafts.com.sun.star.drawing/rendering/geometry moved to com.sun.star.* 2005/02/09 21:24:36 thb 1.5.6.6: #i38960# Using PriorityBooster, to temporarily increase current thread's scheduling priority. This tends to prevent thread preemption during frame preparation (which otherwise will cause one or more frame misses, which in turn causes animation jitter) 2005/02/09 12:20:39 mbu 1.5.6.5: busy loop avoided 2005/01/31 00:13:59 thb 1.5.6.4: #i10000# Added module prefix for elapsedtime.hxx header 2005/01/28 16:13:21 mbu 1.5.6.3: #i38960 2005/01/28 15:52:35 mbu 1.5.6.2: enhanced timer frequency in slideshow update handler 2005/01/27 15:39:23 dbo 1.5.6.1: #i39662# Issue number: Submitted by: Reviewed by: --- sd/source/ui/slideshow/slideshowimpl.cxx | 38 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 4980ec09a99d..ffacdec04d8f 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: slideshowimpl.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: kz $ $Date: 2005-03-01 17:53:28 $ + * last change: $Author: vg $ $Date: 2005-03-10 12:11:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -140,6 +140,8 @@ #include "cppuhelper/exc_hlp.hxx" #include "rtl/ref.hxx" +#include "canvas/elapsedtime.hxx" +#include "canvas/prioritybooster.hxx" // TODO(Q3): This breaks encapsulation. Either export // these strings from avmedia, or provide an XManager @@ -172,7 +174,7 @@ using ::rtl::OString; using ::comphelper::ImplementationReference; using namespace ::com::sun::star; -using namespace ::drafts::com::sun::star; +using namespace ::com::sun::star; using namespace ::com::sun::star::presentation; using namespace ::com::sun::star::drawing; @@ -369,6 +371,7 @@ SlideshowImpl::SlideshowImpl( msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ), msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ), msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ), + mnEntryCounter(0), mnLastPageNumber(-1), mbIsPaused(false), mbInputFreeze(false) @@ -1263,6 +1266,7 @@ bool SlideshowImpl::pause( bool bPause ) { if( bPause != mbIsPaused ) { + mbIsPaused = bPause; if( mxShow.is() ) { bool bRet = mxShow->pause(bPause); @@ -1557,8 +1561,6 @@ double SlideshowImpl::update() const bool bUpdate = xShow->update(fUpdate); if (bUpdate) { - if (fUpdate == 0.0) // ASAP case - fUpdate = 0.033; // lowest time resolution: 30 updates per sec maUpdateTimer.SetTimeout( static_cast(fUpdate * 1000.0) ); maUpdateTimer.Start(); } @@ -1590,22 +1592,32 @@ IMPL_LINK( SlideshowImpl, updateHdl, Timer*, EMPTYARG ) // doing some nMagic const rtl::Reference this_(this); + // prevent recursive calls + if(mnEntryCounter) + return 0; + mnEntryCounter++; + try { - const sal_uInt32 nLoopTime = osl_getGlobalTimer(); - double fUpdate = update(); + // 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. - while (mxShow.is() && - (fUpdate >= 0.0) && (fUpdate <= 0.05) && - ((osl_getGlobalTimer() - nLoopTime) < 500)) - { +// currently no solution, because this kills sound (at least on Windows) +// // Boost our prio, as long as we're in the render loop +// ::canvas::tools::PriorityBooster aBooster(2); + + double fUpdate = update(); + while(mxShow.is() && fUpdate <= 0.0) { + sal_uInt32 nCurrentTime = osl_getGlobalTimer(); Application::Reschedule(); fUpdate = update(); } } catch( Exception& e ) { - e; + static_cast(e); DBG_ERROR( (OString("sd::SlideshowImpl::updateHdl(), " "exception caught: ") + @@ -1614,6 +1626,8 @@ IMPL_LINK( SlideshowImpl, updateHdl, Timer*, EMPTYARG ) RTL_TEXTENCODING_UTF8 )).getStr() ); } + --mnEntryCounter; + return 0; }