Revert "VectorDrawable native rendering - Step 5 of MANY"
Bug: 27136799
This reverts commit 18bdf443e371e9f293439b4ff92cc79abaa422e5.
Change-Id: I825b061eec2a591f2d18119ba64494624b9ad4f2
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h
index fcbc11b..2c9c9c3 100644
--- a/libs/hwui/Animator.h
+++ b/libs/hwui/Animator.h
@@ -24,8 +24,6 @@
#include "utils/Macros.h"
-#include <vector>
-
namespace android {
namespace uirenderer {
@@ -61,14 +59,14 @@
mMayRunAsync = mayRunAsync;
}
bool mayRunAsync() { return mMayRunAsync; }
- ANDROID_API void start();
- ANDROID_API void reset();
- ANDROID_API void reverse();
- // Terminates the animation at its current progress.
- ANDROID_API void cancel();
-
- // Terminates the animation and skip to the end of the animation.
- ANDROID_API void end();
+ 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);
virtual void onAttached() {}
@@ -76,41 +74,36 @@
void pushStaging(AnimationContext& context);
bool animate(AnimationContext& context);
- bool isRunning() { return mPlayState == PlayState::Running
- || mPlayState == PlayState::Reversing; }
+ bool isRunning() { return mPlayState == PlayState::Running; }
bool isFinished() { return mPlayState == PlayState::Finished; }
float finalValue() { return mFinalValue; }
ANDROID_API virtual uint32_t dirtyMask() = 0;
void forceEndNow(AnimationContext& context);
- RenderNode* target() { return mTarget; }
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/Reversing -> Finished
- // ^ |
- // | |
- // ----------------------
+ // 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/Reversing-> Finished
- // ^ |
- // | |
- // ------------------
- // Note that if the animation is in Running/Reversing state, calling start or reverse again
- // would do nothing if the animation has the same play direction as the request; otherwise,
- // the animation would start from where it is and change direction (i.e. Reversing <-> Running)
+ // NotStart -> Running -> Finished
+ // ^ |
+ // | |
+ // -------------
enum class PlayState {
NotStarted,
Running,
- Reversing,
Finished,
+ Restarted,
};
BaseRenderNodeAnimator(float finalValue);
@@ -118,6 +111,7 @@
virtual float getValue(RenderNode* target) const = 0;
virtual void setValue(RenderNode* target, float value) = 0;
+ RenderNode* target() { return mTarget; }
void callOnFinishedListener(AnimationContext& context);
@@ -138,28 +132,13 @@
nsecs_t mDuration;
nsecs_t mStartDelay;
bool mMayRunAsync;
- // Play Time tracks the progress of animation, it should always be [0, mDuration], 0 being
- // the beginning of the animation, will reach mDuration at the end of an animation.
- nsecs_t mPlayTime;
sp<AnimationListener> mListener;
private:
- enum class Request {
- Start,
- Reverse,
- Reset,
- Cancel,
- End
- };
inline void checkMutable();
virtual void transitionToRunning(AnimationContext& context);
void doSetStartValue(float value);
- bool updatePlayTime(nsecs_t playTime);
- void resolveStagingRequest(Request request);
-
- std::vector<Request> mStagingRequests;
-
};
class RenderPropertyAnimator : public BaseRenderNodeAnimator {