TreeInfo.h revision e45b1fd03b524d2b57cc6c222d89076a31a08bea
1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef TREEINFO_H
17#define TREEINFO_H
18
19#include <cutils/compiler.h>
20#include <utils/Timers.h>
21#include <utils/StrongPointer.h>
22
23namespace android {
24namespace uirenderer {
25
26class RenderPropertyAnimator;
27
28class AnimationListener {
29public:
30    ANDROID_API virtual void onAnimationFinished(const sp<RenderPropertyAnimator>&) = 0;
31protected:
32    ANDROID_API virtual ~AnimationListener() {}
33};
34
35struct TreeInfo {
36    // The defaults here should be safe for everyone but DrawFrameTask to use as-is.
37    TreeInfo()
38            : hasFunctors(false)
39            , prepareTextures(false)
40            , performStagingPush(true)
41            , frameTimeMs(0)
42            , evaluateAnimations(false)
43            , hasAnimations(false)
44            , animationListener(0)
45    {}
46
47    bool hasFunctors;
48    bool prepareTextures;
49    bool performStagingPush;
50
51    // Animations
52    nsecs_t frameTimeMs;
53    bool evaluateAnimations;
54    // This is only updated if evaluateAnimations is true
55    bool hasAnimations;
56    AnimationListener* animationListener;
57
58    // TODO: Damage calculations
59};
60
61} /* namespace uirenderer */
62} /* namespace android */
63
64#endif /* TREEINFO_H */
65