Revert "[Tizen] (Animation) Ensure AnimateBy updates the cached event-side properties"
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / animation-impl.h
index 6272042..92dff74 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ANIMATION_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ class Actor;
 class Animation;
 class AnimationPlaylist;
 class Object;
-class ShaderEffect;
 
 typedef IntrusivePtr<Animation> AnimationPtr;
 typedef std::vector<AnimationPtr> AnimationContainer;
@@ -63,8 +62,6 @@ public:
   typedef Dali::Animation::EndAction EndAction;
   typedef Dali::Animation::Interpolation Interpolation;
 
-  typedef void (*FinishedCallback)(Object* object);
-
   /**
    * Create a new Animation object.
    * @param[in] durationSeconds The duration of the animation.
@@ -85,7 +82,22 @@ public:
   /**
    * @copydoc Dali::Animation::SetLooping()
    */
-  void SetLooping(bool looping);
+  void SetLooping(bool on);
+
+  /**
+   * @copydoc Dali::Animation::SetLoopCount()
+   */
+  void SetLoopCount(int count);
+
+  /**
+   * @copydoc Dali::Animation::GetLoopCount()
+   */
+  int GetLoopCount();
+
+  /**
+   * @copydoc Dali::Animation::GetCurrentLoop()
+   */
+  int GetCurrentLoop();
 
   /**
    * @copydoc Dali::Animation::IsLooping()
@@ -144,6 +156,11 @@ public:
   void Pause();
 
   /**
+   * @copydoc Dali::Animation::GetState()
+   */
+  Dali::Animation::State GetState() const;
+
+  /**
    * @copydoc Dali::Animation::Stop()
    */
   void Stop();
@@ -191,13 +208,6 @@ public:
   static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
 
   /**
-   * This callback is intended for internal use only, to avoid the overhead of using a signal.
-   * @param[in] callback The callback function to connect.
-   * @param[in] object The internal object requesting the callback, or NULL.
-   */
-  void SetFinishedCallback( FinishedCallback callback, Object* object );
-
-  /**
    * @copydoc Dali::Animation::AnimateBy(Property target, Property::Value relativeValue)
    */
   void AnimateBy(Property& target, Property::Value& relativeValue);
@@ -429,29 +439,56 @@ private:
   Animation& operator=(const Animation& rhs);
 
 private:
-  EventThreadServices& mEventThreadServices;
-  AnimationPlaylist& mPlaylist;
+
+  struct ConnectorTargetValues
+  {
+    ConnectorTargetValues()
+    : targetValue(),
+      timePeriod( 0.0f ),
+      connectorIndex( 0 )
+    {
+    }
+
+    Property::Value targetValue;
+    TimePeriod timePeriod;
+    unsigned int connectorIndex;
+  };
+
+private:
+
+  /**
+   * Compares the end times of the animators returning true if lhs end time is less than rhs end time.
+   * @param[in] lhs The first comparator
+   * @param[in] rhs The second comparator
+   * @return True if end time of lhs is less, false otherwise.
+   */
+  static bool CompareConnectorEndTimes( const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs );
+
+private:
 
   const SceneGraph::Animation* mAnimation;
 
-  int mNotificationCount; ///< Keep track of how many Finished signals have been emitted.
+  EventThreadServices& mEventThreadServices;
+  AnimationPlaylist& mPlaylist;
 
   Dali::Animation::AnimationSignalType mFinishedSignal;
 
-  FinishedCallback mFinishedCallback;
-  Object* mFinishedCallbackObject;
-
   AnimatorConnectorContainer mConnectors; ///< Owned by the Animation
 
-  // Cached for public getters
+  typedef std::vector< ConnectorTargetValues > ConnectorTargetValuesContainer;
+  ConnectorTargetValuesContainer mConnectorTargetValues; //< Used to store animating property target value information
+
+  Vector2 mPlayRange;
+
   float mDurationSeconds;
   float mSpeedFactor;
-  bool mIsLooping;
-  Vector2 mPlayRange;
+  int mNotificationCount; ///< Keep track of how many Finished signals have been emitted.
+  int mLoopCount;
+  int mCurrentLoop;
   EndAction mEndAction;
   EndAction mDisconnectAction;
   AlphaFunction mDefaultAlpha;
-
+  Dali::Animation::State mState;
 };
 
 } // namespace Internal