include/vcl/animate/Animation.hxx |    2 ++
 vcl/source/animate/Animation.cxx  |   15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 5f88c66b835718c5cc5f07d21825a5ac6880e458
Author:     Chris Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Sat Jun 25 09:31:46 2022 +1000
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed Oct 12 10:11:25 2022 +0200

    vcl: extract function CreateAnimationDataItems
    
    Change-Id: Ifc245b570d82d2fcbcd2cbb83cbd43664b228bf2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76409
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 6c592ba753c1..2f13052d084b 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -28,6 +28,7 @@
 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
 
 class AnimationRenderer;
+struct AnimationData;
 
 class VCL_DLLPUBLIC Animation
 {
@@ -109,6 +110,7 @@ private:
     bool mbIsInAnimation;
     bool mbLoopTerminated;
 
+    SAL_DLLPRIVATE std::vector<std::unique_ptr<AnimationData>> 
CreateAnimationDataItems();
     SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
     DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index fb47e9698a3f..5582c3b9a848 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -282,6 +282,18 @@ void Animation::ImplRestartTimer(sal_uLong nTimeout)
     maTimer.Start();
 }
 
+std::vector<std::unique_ptr<AnimationData>> 
Animation::CreateAnimationDataItems()
+{
+    std::vector<std::unique_ptr<AnimationData>> aDataItems;
+
+    for (auto const& rItem : maRenderers)
+    {
+        aDataItems.emplace_back(rItem->createAnimationData());
+    }
+
+    return aDataItems;
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
     const size_t nAnimCount = maFrames.size();
@@ -293,14 +305,13 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
         if (maNotifyLink.IsSet())
         {
             std::vector<std::unique_ptr<AnimationData>> aDataItems;
-            // create AnimationData-List
             for (auto const& i : maRenderers)
                 aDataItems.emplace_back(i->createAnimationData());
 
             maNotifyLink.Call(this);
 
             // set view state from AnimationData structure
-            for (auto& pDataItem : aDataItems)
+            for (auto& pDataItem : CreateAnimationDataItems())
             {
                 AnimationRenderer* pRenderer = nullptr;
                 if (!pDataItem->mpRendererData)

Reply via email to