John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 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 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 19 | #include <utils/Timers.h> |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 20 | |
| 21 | namespace android { |
| 22 | namespace uirenderer { |
| 23 | |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame^] | 24 | class BaseRenderNodeAnimator; |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 25 | class AnimationListener; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 26 | |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 27 | class AnimationHook { |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 28 | public: |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame^] | 29 | virtual void callOnFinished(BaseRenderNodeAnimator* animator, AnimationListener* listener) = 0; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 30 | protected: |
John Reck | 52244ff | 2014-05-01 21:27:37 -0700 | [diff] [blame] | 31 | ~AnimationHook() {} |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | struct TreeInfo { |
| 35 | // The defaults here should be safe for everyone but DrawFrameTask to use as-is. |
| 36 | TreeInfo() |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 37 | : frameTimeMs(0) |
| 38 | , animationHook(NULL) |
| 39 | , prepareTextures(false) |
| 40 | , performStagingPush(true) |
| 41 | , evaluateAnimations(false) |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 42 | {} |
| 43 | |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 44 | nsecs_t frameTimeMs; |
| 45 | AnimationHook* animationHook; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 46 | bool prepareTextures; |
| 47 | bool performStagingPush; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 48 | bool evaluateAnimations; |
John Reck | f9be779 | 2014-05-02 18:21:16 -0700 | [diff] [blame] | 49 | |
| 50 | struct Out { |
| 51 | Out() |
| 52 | : hasFunctors(false) |
| 53 | , hasAnimations(false) |
| 54 | , requiresUiRedraw(false) |
| 55 | {} |
| 56 | bool hasFunctors; |
| 57 | // This is only updated if evaluateAnimations is true |
| 58 | bool hasAnimations; |
| 59 | // This is set to true if there is an animation that RenderThread cannot |
| 60 | // animate itself, such as if hasFunctors is true |
| 61 | // This is only set if hasAnimations is true |
| 62 | bool requiresUiRedraw; |
| 63 | } out; |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 64 | |
| 65 | // TODO: Damage calculations |
| 66 | }; |
| 67 | |
| 68 | } /* namespace uirenderer */ |
| 69 | } /* namespace android */ |
| 70 | |
| 71 | #endif /* TREEINFO_H */ |