TreeInfo.h revision ff941dcd815021bb20d6504eb486acb1e50592c3
1e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck/*
2e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * Copyright (C) 2014 The Android Open Source Project
3e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck *
4e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * Licensed under the Apache License, Version 2.0 (the "License");
5e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * you may not use this file except in compliance with the License.
6e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * You may obtain a copy of the License at
7e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck *
8e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck *      http://www.apache.org/licenses/LICENSE-2.0
9e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck *
10e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * Unless required by applicable law or agreed to in writing, software
11e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * distributed under the License is distributed on an "AS IS" BASIS,
12e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * See the License for the specific language governing permissions and
14e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck * limitations under the License.
15e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck */
16e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#ifndef TREEINFO_H
17e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#define TREEINFO_H
18e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
19e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#include <utils/Timers.h>
20e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
21e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Recknamespace android {
22e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Recknamespace uirenderer {
23e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
24ff941dcd815021bb20d6504eb486acb1e50592c3John Reckclass BaseRenderNodeAnimator;
2552244fff29042926e21fa897ef5ab11148e35299John Reckclass AnimationListener;
26e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
2752244fff29042926e21fa897ef5ab11148e35299John Reckclass AnimationHook {
28e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reckpublic:
29ff941dcd815021bb20d6504eb486acb1e50592c3John Reck    virtual void callOnFinished(BaseRenderNodeAnimator* animator, AnimationListener* listener) = 0;
30e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reckprotected:
3152244fff29042926e21fa897ef5ab11148e35299John Reck    ~AnimationHook() {}
32e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck};
33e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
34e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reckstruct TreeInfo {
35e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    // The defaults here should be safe for everyone but DrawFrameTask to use as-is.
36e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    TreeInfo()
37f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        : frameTimeMs(0)
38f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        , animationHook(NULL)
39f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        , prepareTextures(false)
40f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        , performStagingPush(true)
41f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        , evaluateAnimations(false)
42e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    {}
43e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
44f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck    nsecs_t frameTimeMs;
45f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck    AnimationHook* animationHook;
46e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    bool prepareTextures;
47e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    bool performStagingPush;
48e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    bool evaluateAnimations;
49f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck
50f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck    struct Out {
51f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        Out()
52f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck            : hasFunctors(false)
53f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck            , hasAnimations(false)
54f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck            , requiresUiRedraw(false)
55f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        {}
56f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        bool hasFunctors;
57f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        // This is only updated if evaluateAnimations is true
58f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        bool hasAnimations;
59f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        // This is set to true if there is an animation that RenderThread cannot
60f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        // animate itself, such as if hasFunctors is true
61f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        // This is only set if hasAnimations is true
62f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck        bool requiresUiRedraw;
63f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck    } out;
64e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
65e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck    // TODO: Damage calculations
66e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck};
67e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
68e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck} /* namespace uirenderer */
69e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck} /* namespace android */
70e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck
71e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#endif /* TREEINFO_H */
72