diff options
author | Doris Liu <tianliu@google.com> | 2016-02-04 22:17:11 +0000 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2016-02-04 16:29:51 -0800 |
commit | 766431aa57c16ece8842287a92b2e7208e3b8ac3 (patch) | |
tree | 9897854d78c4d3615df67e97fd4f65a865729e32 /libs/hwui/Animator.h | |
parent | 2343f8dfcd1b1d0a503463740b85616a966cc299 (diff) |
Revert "Revert "VectorDrawable native rendering - Step 4 of MANY""
This reverts commit 5a11e8d0ba21624025b89ac63bbd18befa55be0e.
Change-Id: I7a48b59c4f930dad65ddc8590c25a12636244ea2
Diffstat (limited to 'libs/hwui/Animator.h')
-rw-r--r-- | libs/hwui/Animator.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h index aea95bfc1c0e..2c9c9c3fe0f9 100644 --- a/libs/hwui/Animator.h +++ b/libs/hwui/Animator.h @@ -59,7 +59,13 @@ public: mMayRunAsync = mayRunAsync; } bool mayRunAsync() { return mMayRunAsync; } - ANDROID_API void start() { mStagingPlayState = PlayState::Running; onStagingPlayStateChanged(); } + ANDROID_API void start() { + if (mStagingPlayState == PlayState::NotStarted) { + mStagingPlayState = PlayState::Running; + } else { + mStagingPlayState = PlayState::Restarted; + } + onStagingPlayStateChanged(); } ANDROID_API void end() { mStagingPlayState = PlayState::Finished; onStagingPlayStateChanged(); } void attach(RenderNode* target); @@ -77,10 +83,27 @@ public: void forceEndNow(AnimationContext& context); protected: + // PlayState is used by mStagingPlayState and mPlayState to track the state initiated from UI + // thread and Render Thread animation state, respectively. + // From the UI thread, mStagingPlayState transition looks like + // NotStarted -> Running -> Finished + // ^ | + // | | + // Restarted <------ + // Note: For mStagingState, the Finished state (optional) is only set when the animation is + // terminated by user. + // + // On Render Thread, mPlayState transition: + // NotStart -> Running -> Finished + // ^ | + // | | + // ------------- + enum class PlayState { NotStarted, Running, Finished, + Restarted, }; BaseRenderNodeAnimator(float finalValue); @@ -93,6 +116,7 @@ protected: void callOnFinishedListener(AnimationContext& context); virtual void onStagingPlayStateChanged() {} + virtual void onPlayTimeChanged(nsecs_t playTime) {} RenderNode* mTarget; |