From 641ea9391fdfc25a6836ffaa86b5c74e2a1f425c Mon Sep 17 00:00:00 2001 From: "Jinho, Lee" Date: Tue, 30 May 2017 16:16:42 +0900 Subject: [PATCH] Revert "[Tizen] (Animation) Reorder animation variables according to size & remove unused" This reverts commit 2e85738caf39e6a650879de4a53c6ebe3cd7d6ac. Change-Id: I6bf770d80aecb816f55f10c6761016faf60ce9ba --- dali/internal/event/animation/animation-impl.cpp | 25 +++++++++++++++++------- dali/internal/event/animation/animation-impl.h | 24 ++++++++++++++++++----- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index 0d70028..c27f31b 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -112,18 +112,17 @@ AnimationPtr Animation::New(float durationSeconds) } Animation::Animation( EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha ) -: mAnimation( NULL ), - mEventThreadServices( eventThreadServices ), +: mEventThreadServices( eventThreadServices ), mPlaylist( playlist ), - mFinishedSignal(), - mConnectors(), - mConnectorTargetValues(), - mPlayRange( Vector2(0.0f,1.0f)), + mAnimation( NULL ), + mNotificationCount( 0 ), + mFinishedCallback( NULL ), + mFinishedCallbackObject( NULL ), mDurationSeconds( durationSeconds ), mSpeedFactor(1.0f), - mNotificationCount( 0 ), mLoopCount(1), mCurrentLoop(0), + mPlayRange( Vector2(0.0f,1.0f)), mEndAction( endAction ), mDisconnectAction( disconnectAction ), mDefaultAlpha( defaultAlpha ), @@ -783,6 +782,12 @@ void Animation::EmitSignalFinish() Dali::Animation handle( this ); mFinishedSignal.Emit( handle ); } + + // This callback is used internally, to avoid the overhead of using a signal. + if ( mFinishedCallback ) + { + mFinishedCallback( mFinishedCallbackObject ); + } } bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) @@ -803,6 +808,12 @@ bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* return connected; } +void Animation::SetFinishedCallback( FinishedCallback callback, Object* object ) +{ + mFinishedCallback = callback; + mFinishedCallbackObject = object; +} + void Animation::AddAnimatorConnector( AnimatorConnectorBase* connector ) { DALI_ASSERT_DEBUG( NULL != connector ); diff --git a/dali/internal/event/animation/animation-impl.h b/dali/internal/event/animation/animation-impl.h index 8554ff4..fa28101 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -62,6 +62,8 @@ 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. @@ -208,6 +210,13 @@ 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); @@ -446,28 +455,33 @@ private: Property::Value targetValue; }; - const SceneGraph::Animation* mAnimation; - EventThreadServices& mEventThreadServices; AnimationPlaylist& mPlaylist; + const SceneGraph::Animation* mAnimation; + + int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. + Dali::Animation::AnimationSignalType mFinishedSignal; + FinishedCallback mFinishedCallback; + Object* mFinishedCallbackObject; + AnimatorConnectorContainer mConnectors; ///< Owned by the Animation std::vector< ConnectorTargetValues > mConnectorTargetValues; //< Used to store animating property target value information - Vector2 mPlayRange; - + // Cached for public getters float mDurationSeconds; float mSpeedFactor; - int mNotificationCount; ///< Keep track of how many Finished signals have been emitted. int mLoopCount; int mCurrentLoop; + Vector2 mPlayRange; EndAction mEndAction; EndAction mDisconnectAction; AlphaFunction mDefaultAlpha; Dali::Animation::State mState; + }; } // namespace Internal -- 2.7.4