| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include <set> |
| 20 |
#include <vector> |
| 21 |
|
| 22 |
#include "AnimationContext.h" |
| 23 |
#include "Animator.h" |
| 24 |
#include <IContextFactory.h> |
| 25 |
#include "PropertyValuesAnimatorSet.h" |
| 26 |
#include "RenderNode.h" |
| 27 |
|
| 28 |
namespace android::uirenderer { |
| 29 |
|
| 30 |
class RootRenderNode : public RenderNode { |
| 31 |
public: |
| 32 |
explicit RootRenderNode(std::unique_ptr<ErrorHandler> errorHandler) |
| 33 |
: RenderNode(), mErrorHandler(std::move(errorHandler)) {} |
| 34 |
|
| 35 |
virtual ~RootRenderNode() {} |
| 36 |
|
| 37 |
virtual void prepareTree(TreeInfo& info) override; |
| 38 |
|
| 39 |
void attachAnimatingNode(RenderNode* animatingNode); |
| 40 |
|
| 41 |
void attachPendingVectorDrawableAnimators(); |
| 42 |
|
| 43 |
void detachAnimators(); |
| 44 |
|
| 45 |
void pauseAnimators(); |
| 46 |
|
| 47 |
void doAttachAnimatingNodes(AnimationContext* context); |
| 48 |
|
| 49 |
|
| 50 |
void runVectorDrawableAnimators(AnimationContext* context, TreeInfo& info); |
| 51 |
|
| 52 |
void trimPausedVDAnimators(AnimationContext* context); |
| 53 |
|
| 54 |
void pushStagingVectorDrawableAnimators(AnimationContext* context); |
| 55 |
|
| 56 |
void destroy(); |
| 57 |
|
| 58 |
void addVectorDrawableAnimator(PropertyValuesAnimatorSet* anim); |
| 59 |
|
| 60 |
private: |
| 61 |
const std::unique_ptr<ErrorHandler> mErrorHandler; |
| 62 |
std::vector<sp<RenderNode> > mPendingAnimatingRenderNodes; |
| 63 |
std::set<sp<PropertyValuesAnimatorSet> > mPendingVectorDrawableAnimators; |
| 64 |
std::set<sp<PropertyValuesAnimatorSet> > mRunningVDAnimators; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
std::set<sp<PropertyValuesAnimatorSet> > mPausedVDAnimators; |
| 73 |
|
| 74 |
void detachVectorDrawableAnimator(PropertyValuesAnimatorSet* anim); |
| 75 |
}; |
| 76 |
|
| 77 |
#ifdef __ANDROID__ |
| 78 |
class ContextFactoryImpl : public IContextFactory { |
| 79 |
public: |
| 80 |
explicit ContextFactoryImpl(RootRenderNode* rootNode) : mRootNode(rootNode) {} |
| 81 |
|
| 82 |
virtual AnimationContext* createAnimationContext(renderthread::TimeLord& clock) override; |
| 83 |
|
| 84 |
private: |
| 85 |
RootRenderNode* mRootNode; |
| 86 |
}; |
| 87 |
#endif |
| 88 |
|
| 89 |
} |