summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <q.sarperakdemir@gmail.com>2020-08-06 10:32:55 +0300
committerSarper Akdemir <q.sarperakdemir@gmail.com>2020-08-08 20:38:04 +0300
commite486d22139bdec2b20b2f21907aeb4e29a69d5ae (patch)
treee3bb5e35d2af6939cb0ce20f6336477062bdaffb
parent1f17fb8696ff096630bd3fd38aed0e2f21a9a02e (diff)
make physics based animation effects always processed lastprivate/quwex/gsoc-box2d-experimental
Change-Id: I92d436aced6ef3ee2c8b0bf0167c1f7e642ba3b5
-rw-r--r--slideshow/source/engine/activitiesqueue.cxx22
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx6
-rw-r--r--slideshow/source/inc/activitiesqueue.hxx7
3 files changed, 31 insertions, 4 deletions
diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx
index ba982385356e..38e79d1e5677 100644
--- a/slideshow/source/engine/activitiesqueue.cxx
+++ b/slideshow/source/engine/activitiesqueue.cxx
@@ -50,6 +50,8 @@ namespace slideshow::internal
{
for( const auto& pActivity : maCurrentActivitiesWaiting )
pActivity->dispose();
+ for( const auto& pActivity : maCurrentActivitiesToBeProcessedLast )
+ pActivity->dispose();
for( const auto& pActivity : maCurrentActivitiesReinsert )
pActivity->dispose();
}
@@ -59,7 +61,7 @@ namespace slideshow::internal
}
}
- bool ActivitiesQueue::addActivity( const ActivitySharedPtr& pActivity )
+ bool ActivitiesQueue::addActivity( const ActivitySharedPtr& pActivity, const bool bProcessLast )
{
OSL_ENSURE( pActivity, "ActivitiesQueue::addActivity: activity ptr NULL" );
@@ -67,7 +69,17 @@ namespace slideshow::internal
return false;
// add entry to waiting list
- maCurrentActivitiesWaiting.push_back( pActivity );
+ if( !bProcessLast )
+ {
+ maCurrentActivitiesWaiting.push_back( pActivity );
+ }
+ else
+ {
+ // Activities that should be processed last is kept in a different
+ // ActivityQueue, and later added to the end of the maCurrentActivitiesWaiting
+ // at the start of ActivitiesQueue::process()
+ maCurrentActivitiesToBeProcessedLast.push_back( pActivity );
+ }
return true;
}
@@ -76,6 +88,12 @@ namespace slideshow::internal
{
SAL_INFO("slideshow.verbose", "ActivitiesQueue: outer loop heartbeat" );
+ // If there are activities to be processed last add them to the end of the ActivitiesQueue
+ maCurrentActivitiesWaiting.insert( maCurrentActivitiesWaiting.end(),
+ maCurrentActivitiesToBeProcessedLast.begin(),
+ maCurrentActivitiesToBeProcessedLast.end() );
+ maCurrentActivitiesToBeProcessedLast.clear();
+
// accumulate time lag for all activities, and lag time
// base if necessary:
double fLag = 0.0;
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx
index 4dcb640795aa..7999b5a7654a 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.cxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
#include "nodetools.hxx"
#include <doctreenode.hxx>
@@ -294,7 +295,10 @@ void AnimationBaseNode::activate_st()
mpActivity->setTargets( getShape(), maAttributeLayerHolder.get() );
// add to activities queue
- getContext().mrActivitiesQueue.addActivity( mpActivity );
+ if( mxAnimateNode->getType() == css::animations::AnimationNodeType::ANIMATEPHYSICS )
+ getContext().mrActivitiesQueue.addActivity(mpActivity, true);
+ else
+ getContext().mrActivitiesQueue.addActivity( mpActivity );
}
else {
// Actually, DO generate the event for empty activity,
diff --git a/slideshow/source/inc/activitiesqueue.hxx b/slideshow/source/inc/activitiesqueue.hxx
index b4f88b1b39d1..76dc981f8f65 100644
--- a/slideshow/source/inc/activitiesqueue.hxx
+++ b/slideshow/source/inc/activitiesqueue.hxx
@@ -57,7 +57,7 @@ namespace slideshow
/** Add the given activity to the queue.
*/
- bool addActivity( const ActivitySharedPtr& pActivity );
+ bool addActivity( const ActivitySharedPtr& pActivity, const bool bProcessLast = false );
/** Process the activities queue.
@@ -96,6 +96,11 @@ namespace slideshow
// await processing for this
// round
+ ActivityQueue maCurrentActivitiesToBeProcessedLast; // activities that will be
+ // added to the end of
+ // maCurrentActivitiesWaiting at
+ // the start of process()
+
ActivityQueue maCurrentActivitiesReinsert; // currently running
// activities, that are
// already processed for