slideshow/source/engine/animationnodes/basecontainernode.cxx |   16 ++++---
 slideshow/source/engine/animationnodes/basenode.cxx          |   24 ++++++++---
 slideshow/source/inc/basecontainernode.hxx                   |    1 
 3 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit 6be929b4ec00d69c24c25e16b39a00f79363d878
Author:     Mark Hung <mark...@gmail.com>
AuthorDate: Sat Feb 16 08:44:36 2019 +0800
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Thu Mar 21 17:15:39 2019 +0100

    tdf#77186 handle time container indefinite repetition.
    
    Indefinite duration isn't necessary for indefinite repetition,
    so simply check the number of iteration left and do not decrease
    the number when the repetition is indefinite.
    
    Note: a known issue is that the next effect starts before
    "until click" or "until next slide" if the starting time of
    the next slide is "after previous". A workaround is to set
    the starting time of the next slide to "click".
    
    Change-Id: Ie9c73b472dc400bc41501029ff19ecc3e3fab2df
    Reviewed-on: https://gerrit.libreoffice.org/67896
    Tested-by: Jenkins
    Reviewed-by: Mark Hung <mark...@gmail.com>
    (cherry picked from commit cacdb1ae9d9e249737d0b3732e6fd198cfdd9d82)
    Reviewed-on: https://gerrit.libreoffice.org/69100
    Tested-by: Xisco FaulĂ­ <xiscofa...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/slideshow/source/engine/animationnodes/basecontainernode.cxx 
b/slideshow/source/engine/animationnodes/basecontainernode.cxx
index bb3c7e3739a7..d48df81161cb 100644
--- a/slideshow/source/engine/animationnodes/basecontainernode.cxx
+++ b/slideshow/source/engine/animationnodes/basecontainernode.cxx
@@ -41,6 +41,7 @@ BaseContainerNode::BaseContainerNode(
       maChildren(),
       mnFinishedChildren(0),
       mnLeftIterations(0),
+      mbRepeatIndefinite(xNode->getRepeatCount().hasValue() && 
isIndefiniteTiming(xNode->getRepeatCount())),
       mbDurationIndefinite( isIndefiniteTiming( xNode->getEnd() ) &&
                             isIndefiniteTiming( xNode->getDuration() ) )
 {
@@ -137,12 +138,9 @@ bool BaseContainerNode::notifyDeactivatedChild(
     ++mnFinishedChildren;
     bool bFinished = (mnFinishedChildren >= nSize);
 
-    // all children finished, and we've got indefinite duration?
-    // think of ParallelTimeContainer::notifyDeactivating()
-    // if duration given, we will be deactivated by some end event
-    // @see fillCommonParameters()
-    if (bFinished && isDurationIndefinite()) {
-        if( mnLeftIterations >= 1.0 )
+    // Handle repetition here.
+    if (bFinished) {
+        if(!mbRepeatIndefinite && mnLeftIterations >= 1.0)
         {
             mnLeftIterations -= 1.0;
         }
@@ -155,7 +153,7 @@ bool BaseContainerNode::notifyDeactivatedChild(
                                "BaseContainerNode::repeat");
             getContext().mrEventQueue.addEvent( aRepetitionEvent );
         }
-        else
+        else if (isDurationIndefinite())
         {
             deactivate();
         }
@@ -166,6 +164,10 @@ bool BaseContainerNode::notifyDeactivatedChild(
 
 void BaseContainerNode::repeat()
 {
+    // Prevent repeat event scheduled before deactivation.
+    if (getState() == FROZEN || getState() == ENDED)
+        return;
+
     forEachChildNode( std::mem_fn(&AnimationNode::end), ~ENDED );
     bool bState = init_children();
     if( bState )
diff --git a/slideshow/source/engine/animationnodes/basenode.cxx 
b/slideshow/source/engine/animationnodes/basenode.cxx
index bfe066e5b5a9..560cd407c5a0 100644
--- a/slideshow/source/engine/animationnodes/basenode.cxx
+++ b/slideshow/source/engine/animationnodes/basenode.cxx
@@ -539,12 +539,26 @@ void BaseNode::scheduleDeactivationEvent( EventSharedPtr 
const& pEvent )
         // if anim base node has no activity, this is called to schedule 
deactivation,
         // but what if it does not schedule anything?
 
-        // TODO(F2): Handle end time attribute, too
         auto self(mpSelf);
-        mpCurrentEvent = generateEvent(
-            mxAnimationNode->getDuration(),
-            [self] () { self->deactivate(); },
-            maContext, 0.0 );
+        if (mxAnimationNode->getEnd().hasValue())
+        {
+            // TODO: We may need to calculate the duration if the end value is 
numeric.
+            // We expect that the end value contains EventTrigger::ON_NEXT 
here.
+            // LibreOffice does not generate numeric values, so we can leave it
+            // until we find a test case.
+            mpCurrentEvent = generateEvent(
+                mxAnimationNode->getEnd(),
+                [self] () { self->deactivate(); },
+                maContext, 0.0 );
+
+        }
+        else
+        {
+            mpCurrentEvent = generateEvent(
+                mxAnimationNode->getDuration(),
+                [self] () { self->deactivate(); },
+                maContext, 0.0 );
+        }
     }
 }
 
diff --git a/slideshow/source/inc/basecontainernode.hxx 
b/slideshow/source/inc/basecontainernode.hxx
index 6338fb026c7c..fe019dd999dd 100644
--- a/slideshow/source/inc/basecontainernode.hxx
+++ b/slideshow/source/inc/basecontainernode.hxx
@@ -88,6 +88,7 @@ protected:
     double       mnLeftIterations;
 
 private:
+    const bool          mbRepeatIndefinite;
     const bool          mbDurationIndefinite;
 };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to