TreeInfo.h revision a5dda645da738da7b4ae15e28fa7d93d3b04b94f
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) 55a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck , canDrawThisFrame(true) 56f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck {} 57f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck bool hasFunctors; 58f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck // This is only updated if evaluateAnimations is true 59f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck bool hasAnimations; 60f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck // This is set to true if there is an animation that RenderThread cannot 61f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck // animate itself, such as if hasFunctors is true 62f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck // This is only set if hasAnimations is true 63f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck bool requiresUiRedraw; 64a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck // This is set to true if draw() can be called this frame 65a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck // false means that we must delay until the next vsync pulse as frame 66a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck // production is outrunning consumption 67a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck // NOTE that if this is false CanvasContext will set either requiresUiRedraw 68a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck // *OR* will post itself for the next vsync automatically, use this 69a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck // only to avoid calling draw() 70a5dda645da738da7b4ae15e28fa7d93d3b04b94fJohn Reck bool canDrawThisFrame; 71f9be77940e365036fecd8cc0e491e8545c34e79bJohn Reck } out; 72e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 73e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck // TODO: Damage calculations 74e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck}; 75e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 76e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck} /* namespace uirenderer */ 77e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck} /* namespace android */ 78e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck 79e45b1fd03b524d2b57cc6c222d89076a31a08beaJohn Reck#endif /* TREEINFO_H */ 80