summaryrefslogtreecommitdiff
path: root/libs/hwui/Animator.h
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2016-01-07 13:49:26 -0800
committerDoris Liu <tianliu@google.com>2016-02-02 15:04:01 -0800
commitf276acd98457bcaabc9e79a17a736b3b484f005e (patch)
treeb9efee10194c520b09a4813f7b8074be9a2f99c8 /libs/hwui/Animator.h
parent650e3b70e4aa2fa9acf2f9c6ce211c4b46862c15 (diff)
VectorDrawable native rendering - Step 4 of MANY
This CL runs VectorDrawable animation on RenderThread. The changes in this CL include: - Convert all the animators in AnimatorSet for AVD into a set of RenderNodeAnimators. - Hook up the new animators with RenderThread - Add drawOp in RecordingCanvas for drawing VD so that during the animation on RenderThread, all the property changes on VD can be reflected on the screen. TODO: - Implement reverse and reset for AVD. Change-Id: I2df1d754f2db0ad098d9c15dde4bb2bdfafc2315
Diffstat (limited to 'libs/hwui/Animator.h')
-rw-r--r--libs/hwui/Animator.h26
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;