summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/activitiesqueue.cxx
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2004-11-26 17:45:21 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2004-11-26 17:45:21 +0000
commit7ff4a6efd7e28831f0ee10e9fdee219e77d544f0 (patch)
treea2c0bd4cfd2e92aac9f64f6bcbaabcc50126ab3c /slideshow/source/engine/activitiesqueue.cxx
parent5544eaf303c135192b6e535b47bd65fc76babbab (diff)
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED
2004/11/01 22:28:42 thb 1.2.2.14: #110496# Various fixes: Added true shape bound functionality (to limit e.g. sprite size to area actually painted into); Added explicit check in ActivitiesQueue, whether the LayerManager has any pending updates; Factored out a generic lerp from ActivitiesFactory; Improved docs; Performance optimizations: added profiling traces 2004/10/08 20:08:14 thb 1.2.2.13: #i34997# Fixed several node state inconsistencies, which led to start/end activities not correctly updating the shapes; added proper updating behaviour to LayerManager (several display-changing cases were missing); fixed SLIDEWIPE for shape transitions; improved docs and structure slightly 2004/09/12 21:03:38 thb 1.2.2.12: #110496# Now painting views black, intially. The slide now has an explicit shape, which, if necessary, paints the page background in white. Furthermore, slide transitions now handle the case correctly, when the leaving slide is invalid 2004/08/27 18:54:29 thb 1.2.2.11: #110496# Implemented slide transitions, fixed some minor sd integration probs (repaints, updateScreen 2004/08/26 12:33:52 thb 1.2.2.10: #110496# Fixed the problem that a slide's LayerManager stayed registered at the ActivitiesQueue; work-arounded various basegfx clipper bugs; fixed the problem that the SlideChanger painted repeatedly into its sprites 2004/08/19 00:17:16 thb 1.2.2.9: #110496# Mostly fixes for correct text animation and iteration, plus a first working version of an optimized redraw 2004/08/09 11:50:05 thb 1.2.2.8: #i10000# Fixed various const-incorrectnesses (made the stuff compile under Linux and Solaris) 2004/08/01 20:08:11 thb 1.2.2.7: #110496# Changed slideshow API to match the needs of sd more closely 2004/07/26 14:10:08 thb 1.2.2.6: #i10000# Madebind and mem_fn build under Solaris 2004/07/22 19:41:56 thb 1.2.2.5: #110496# Slideshow milestone, all smil attributes implemented, effects basically working, UI events basically working, text iterations working 2004/05/27 20:51:30 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 15:04:59 thb 1.2.2.3: Initial revision 2004/05/23 08:22:35 thb 1.2.2.2: #110496# First working version with SMIL support (basic effects only 2004/04/05 16:06:00 thb 1.2.2.1: Resync with canvas01 changes
Diffstat (limited to 'slideshow/source/engine/activitiesqueue.cxx')
-rw-r--r--slideshow/source/engine/activitiesqueue.cxx123
1 files changed, 104 insertions, 19 deletions
diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx
index 21e4b981a3e6..828a9accb8c4 100644
--- a/slideshow/source/engine/activitiesqueue.cxx
+++ b/slideshow/source/engine/activitiesqueue.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: activitiesqueue.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: thb $ $Date: 2004-03-18 10:44:24 $
+ * last change: $Author: rt $ $Date: 2004-11-26 18:45:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,15 +59,26 @@
*
************************************************************************/
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
+// must be first
+#include <canvas/debug.hxx>
+
#ifndef _CANVAS_VERBOSETRACE_HXX
#include <canvas/verbosetrace.hxx>
#endif
-#include "activity.hxx"
-#include "activitiesqueue.hxx"
+#ifndef BOOST_BIND_HPP_INCLUDED
+#include <boost/bind.hpp>
+#endif
+#ifndef BOOST_MEM_FN_HPP_INCLUDED
+#include <boost/mem_fn.hpp>
+#endif
+
+#include <algorithm>
+
+#include <slideshowexceptions.hxx>
+#include <activity.hxx>
+#include <activitiesqueue.hxx>
+
using namespace ::drafts::com::sun::star;
using namespace ::com::sun::star;
@@ -76,14 +87,26 @@ namespace presentation
{
namespace internal
{
- ActivitiesQueue::ActivitiesQueue( const ::cppcanvas::SpriteCanvasSharedPtr& rDisplayCanvas ) :
- mpSpriteCanvas( rDisplayCanvas ),
+ ActivitiesQueue::ActivitiesQueue( const UnoViewContainer& rViews ) :
+ mpLayerManager(),
maCurrentActivitiesWaiting(),
maCurrentActivitiesReinsert(),
+ mrViews( rViews ),
mbCurrentRoundNeedsScreenUpdate( false )
{
}
+ ActivitiesQueue::~ActivitiesQueue()
+ {
+ // dispose all queues
+ ::std::for_each( maCurrentActivitiesWaiting.begin(),
+ maCurrentActivitiesWaiting.end(),
+ ::boost::mem_fn(&Disposable::dispose) );
+ ::std::for_each( maCurrentActivitiesReinsert.begin(),
+ maCurrentActivitiesReinsert.end(),
+ ::boost::mem_fn(&Disposable::dispose) );
+ }
+
bool ActivitiesQueue::addActivity( const ActivitySharedPtr& pActivity )
{
OSL_ENSURE( pActivity.get() != NULL, "ActivitiesQueue::addActivity: activity ptr NULL" );
@@ -101,8 +124,14 @@ namespace presentation
{
VERBOSE_TRACE( "ActivitiesQueue: outer loop heartbeat" );
+ bool bPerformScreenUpdate( false );
+
+ // was:
+ // if( !maCurrentActivitiesWaiting.empty() )
+ // for low-prio activities
+
// process list of activities
- if( !maCurrentActivitiesWaiting.empty() )
+ while( !maCurrentActivitiesWaiting.empty() )
{
// process topmost activity
ActivitySharedPtr pActivity( maCurrentActivitiesWaiting.front() );
@@ -114,18 +143,34 @@ namespace presentation
{
// fire up activity
bReinsert = pActivity->perform();
+ }
+ catch( uno::Exception& )
+ {
+ // catch anything here, we don't want
+ // to leave this scope under _any_
+ // circumstance. Although, do _not_
+ // reinsert an activity that threw
+ // once.
- OSL_ENSURE( bReinsert == pActivity->isActive(),
- "::presentation::internal::ActivitiesQueue: Inconsistent Activity state" );
+ // NOTE: we explicitely don't catch(...) here,
+ // since this will also capture segmentation
+ // violations and the like. In such a case, we
+ // still better let our clients now...
+ OSL_TRACE( "::presentation::internal::ActivitiesQueue: Activity threw a uno::Exception, removing from ring" );
}
- catch(...)
+ catch( SlideShowException& )
{
// catch anything here, we don't want
// to leave this scope under _any_
// circumstance. Although, do _not_
// reinsert an activity that threw
// once.
- OSL_TRACE( "::presentation::internal::ActivitiesQueue: Activity threw, removing from ring" );
+
+ // NOTE: we explicitely don't catch(...) here,
+ // since this will also capture segmentation
+ // violations and the like. In such a case, we
+ // still better let our clients now...
+ OSL_TRACE( "::presentation::internal::ActivitiesQueue: Activity threw a SlideShowException, removing from ring" );
}
// always query need for screen updates. Note that
@@ -145,12 +190,9 @@ namespace presentation
// reinsert
if( maCurrentActivitiesWaiting.empty() )
{
- if( mbCurrentRoundNeedsScreenUpdate &&
- mpSpriteCanvas.get() != NULL )
+ if( mbCurrentRoundNeedsScreenUpdate )
{
- // flush rendered content to screen, in a
- // controlled, atomic update operation
- mpSpriteCanvas->updateScreen();
+ bPerformScreenUpdate = true;
}
// always clear update flag. There's no need to update
@@ -168,6 +210,34 @@ namespace presentation
maCurrentActivitiesWaiting.swap( maCurrentActivitiesReinsert );
}
}
+
+ // perform screen update (not only if one of the
+ // activities requested that, but also if the layer
+ // manager signals that it needs one. This frees us from
+ // introducing dummy activities, just to trigger screen
+ // updates. OTOH, this makes it necessary to always call
+ // BOTH event queue and activities queue, such that no
+ // pending update is unduly delayed)
+ if( bPerformScreenUpdate ||
+ (mpLayerManager.get() &&
+ mpLayerManager->isUpdatePending() ) )
+ {
+ // call update() on the registered
+ // LayerManager. This will only update the
+ // backbuffer, not flush anything to screen
+ if( mpLayerManager.get() )
+ mpLayerManager->update();
+
+ // call updateScreen() on all registered views (which
+ // will copy the backbuffers to the front). Do NOT use
+ // LayerManager::updateScreen(), we might need screen
+ // updates independent from a valid LayerManager.
+ ::std::for_each( mrViews.begin(),
+ mrViews.end(),
+ ::boost::mem_fn( &View::updateScreen ) );
+
+ VERBOSE_TRACE( "ActivitiesQueue: update done" );
+ }
}
bool ActivitiesQueue::isEmpty()
@@ -175,5 +245,20 @@ namespace presentation
return maCurrentActivitiesWaiting.empty() && maCurrentActivitiesReinsert.empty();
}
+ void ActivitiesQueue::setLayerManager( const LayerManagerSharedPtr& rMgr )
+ {
+ mpLayerManager = rMgr;
+ }
+
+ void ActivitiesQueue::clear()
+ {
+ ActivityQueue aTmp0;
+ maCurrentActivitiesWaiting.swap( aTmp0 );
+
+ ActivityQueue aTmp1;
+ maCurrentActivitiesReinsert.swap( aTmp1 );
+
+ mbCurrentRoundNeedsScreenUpdate = false;
+ }
}
}