summaryrefslogtreecommitdiff
path: root/slideshow/source
diff options
context:
space:
mode:
authorSarper Akdemir <q.sarperakdemir@gmail.com>2020-08-06 10:32:55 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-08-21 16:31:52 +0200
commit76f3218b32acbc1b67bd291ac84067c83f6e3c2f (patch)
tree6dce8dbcb0615a180ac2eeaea5760842c0783288 /slideshow/source
parentf3272cd389d66e249d189b1810dbf685b14a00ba (diff)
make physics animation effects always processed last
Makes it possible to add activities that will be processed last in the queue. Makes physics animation effects queued this way. And fixes the bug that makes physics animation effects appear out of sync for a frame with the shapes that other in parallel animation effects control. Change-Id: I92d436aced6ef3ee2c8b0bf0167c1f7e642ba3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100713 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Jenkins
Diffstat (limited to 'slideshow/source')
-rw-r--r--slideshow/source/engine/activitiesqueue.cxx23
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx11
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.hxx5
-rw-r--r--slideshow/source/engine/animationnodes/animationphysicsnode.cxx5
-rw-r--r--slideshow/source/engine/animationnodes/animationphysicsnode.hxx1
-rw-r--r--slideshow/source/inc/activitiesqueue.hxx7
6 files changed, 48 insertions, 4 deletions
diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx
index ba982385356e..2e3b29d9dbc7 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 : maCurrentTailActivitiesWaiting )
+ pActivity->dispose();
for( const auto& pActivity : maCurrentActivitiesReinsert )
pActivity->dispose();
}
@@ -72,10 +74,31 @@ namespace slideshow::internal
return true;
}
+ bool ActivitiesQueue::addTailActivity(const ActivitySharedPtr &pActivity)
+ {
+ OSL_ENSURE( pActivity, "ActivitiesQueue::addTailActivity: activity ptr NULL" );
+
+ if( !pActivity )
+ return false;
+
+ // Activities that should be processed last are kept in a different
+ // ActivityQueue, and later appended to the end of the maCurrentActivitiesWaiting
+ // on the beginning of ActivitiesQueue::process()
+ maCurrentTailActivitiesWaiting.push_back( pActivity );
+
+ return true;
+ }
+
void ActivitiesQueue::process()
{
SAL_INFO("slideshow.verbose", "ActivitiesQueue: outer loop heartbeat" );
+ // If there are activities to be processed last append them to the end of the ActivitiesQueue
+ maCurrentActivitiesWaiting.insert( maCurrentActivitiesWaiting.end(),
+ maCurrentTailActivitiesWaiting.begin(),
+ maCurrentTailActivitiesWaiting.end() );
+ maCurrentTailActivitiesWaiting.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..1a15bf2de843 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.cxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -45,12 +45,12 @@ AnimationBaseNode::AnimationBaseNode(
mxAnimateNode( xNode, uno::UNO_QUERY_THROW ),
maAttributeLayerHolder(),
maSlideSize( rContext.maSlideSize ),
- mpActivity(),
mpShape(),
mpShapeSubset(),
mpSubsetManager(rContext.maContext.mpSubsettableShapeManager),
mbPreservedVisibility(true),
- mbIsIndependentSubset( rContext.mbIsIndependentSubset )
+ mbIsIndependentSubset( rContext.mbIsIndependentSubset ),
+ mpActivity()
{
// extract native node targets
// ===========================
@@ -294,7 +294,7 @@ void AnimationBaseNode::activate_st()
mpActivity->setTargets( getShape(), maAttributeLayerHolder.get() );
// add to activities queue
- getContext().mrActivitiesQueue.addActivity( mpActivity );
+ enqueueActivity();
}
else {
// Actually, DO generate the event for empty activity,
@@ -372,6 +372,11 @@ bool AnimationBaseNode::hasPendingAnimation() const
return true;
}
+bool AnimationBaseNode::enqueueActivity() const
+{
+ return getContext().mrActivitiesQueue.addActivity( mpActivity );
+}
+
#if defined(DBG_UTIL)
void AnimationBaseNode::showState() const
{
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.hxx b/slideshow/source/engine/animationnodes/animationbasenode.hxx
index d31a3a5a2fc9..6bb5cd1f2ff7 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.hxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.hxx
@@ -59,6 +59,7 @@ protected:
private:
virtual bool hasPendingAnimation() const override;
+ virtual bool enqueueActivity() const;
private: // state transition callbacks
virtual bool init_st() override;
@@ -79,7 +80,6 @@ private:
css::uno::Reference<css::animations::XAnimate> mxAnimateNode;
ShapeAttributeLayerHolder maAttributeLayerHolder;
::basegfx::B2DVector maSlideSize;
- AnimationActivitySharedPtr mpActivity;
/// When valid, this node has a plain target shape
AttributableShapeSharedPtr mpShape;
@@ -88,6 +88,9 @@ private:
SubsettableShapeManagerSharedPtr mpSubsetManager;
bool mbPreservedVisibility;
bool mbIsIndependentSubset;
+
+protected:
+ AnimationActivitySharedPtr mpActivity;
};
} // namespace presentation::internal
diff --git a/slideshow/source/engine/animationnodes/animationphysicsnode.cxx b/slideshow/source/engine/animationnodes/animationphysicsnode.cxx
index 28e247c30d6c..8f531ea24ed7 100644
--- a/slideshow/source/engine/animationnodes/animationphysicsnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationphysicsnode.cxx
@@ -43,6 +43,11 @@ AnimationActivitySharedPtr AnimationPhysicsNode::createActivity() const
true);
}
+bool AnimationPhysicsNode::enqueueActivity() const
+{
+ return getContext().mrActivitiesQueue.addTailActivity(mpActivity);
+}
+
} // namespace slideshow::internal
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/animationnodes/animationphysicsnode.hxx b/slideshow/source/engine/animationnodes/animationphysicsnode.hxx
index 15ac8911e916..8517dbbb803b 100644
--- a/slideshow/source/engine/animationnodes/animationphysicsnode.hxx
+++ b/slideshow/source/engine/animationnodes/animationphysicsnode.hxx
@@ -44,6 +44,7 @@ protected:
private:
virtual AnimationActivitySharedPtr createActivity() const override;
+ virtual bool enqueueActivity() const override;
css::uno::Reference<css::animations::XAnimateMotion> mxPhysicsMotionNode;
};
diff --git a/slideshow/source/inc/activitiesqueue.hxx b/slideshow/source/inc/activitiesqueue.hxx
index 7169c46f7cf3..9fd3df83a9bb 100644
--- a/slideshow/source/inc/activitiesqueue.hxx
+++ b/slideshow/source/inc/activitiesqueue.hxx
@@ -57,6 +57,10 @@ namespace slideshow::internal
*/
bool addActivity( const ActivitySharedPtr& pActivity );
+ /** Add the given activity prioritized last in the queue.
+ */
+ bool addTailActivity( const ActivitySharedPtr& pActivity );
+
/** Process the activities queue.
This method performs the smallest atomic processing
@@ -94,6 +98,9 @@ namespace slideshow::internal
// await processing for this
// round
+ ActivityQueue maCurrentTailActivitiesWaiting; // activities that will be
+ // processed last in the queue
+
ActivityQueue maCurrentActivitiesReinsert; // currently running
// activities, that are
// already processed for