John Reck | 68bfe0a | 2014-06-24 15:34:58 -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 ANIMATORMANAGER_H |
| 17 | #define ANIMATORMANAGER_H |
| 18 | |
| 19 | #include <vector> |
| 20 | |
| 21 | #include <cutils/compiler.h> |
| 22 | #include <utils/StrongPointer.h> |
| 23 | |
| 24 | #include "TreeInfo.h" |
| 25 | #include "utils/Macros.h" |
| 26 | |
| 27 | namespace android { |
| 28 | namespace uirenderer { |
| 29 | |
| 30 | class BaseRenderNodeAnimator; |
| 31 | class RenderNode; |
| 32 | |
| 33 | // Responsible for managing the animators for a single RenderNode |
| 34 | class AnimatorManager { |
| 35 | PREVENT_COPY_AND_ASSIGN(AnimatorManager); |
| 36 | public: |
| 37 | AnimatorManager(RenderNode& parent); |
| 38 | ~AnimatorManager(); |
| 39 | |
| 40 | void addAnimator(const sp<BaseRenderNodeAnimator>& animator); |
| 41 | |
| 42 | void pushStaging(TreeInfo& info); |
| 43 | void animate(TreeInfo& info); |
| 44 | |
| 45 | private: |
| 46 | RenderNode& mParent; |
| 47 | |
| 48 | // To improve the efficiency of resizing & removing from the vector |
| 49 | // use manual ref counting instead of sp<>. |
| 50 | std::vector<BaseRenderNodeAnimator*> mNewAnimators; |
| 51 | std::vector<BaseRenderNodeAnimator*> mAnimators; |
| 52 | }; |
| 53 | |
| 54 | } /* namespace uirenderer */ |
| 55 | } /* namespace android */ |
| 56 | |
| 57 | #endif /* ANIMATORMANAGER_H */ |