blob: b170dcb02ac82e701bc4cafb27927679822c1891 [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 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
17#ifndef ANDROID_ORIENTATION_ANIMATION_H
18#define ANDROID_ORIENTATION_ANIMATION_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include "SurfaceFlinger.h"
24
25namespace android {
26
27// ---------------------------------------------------------------------------
28
29class SurfaceFlinger;
30class MemoryDealer;
31class LayerOrientationAnim;
32
33class OrientationAnimation
34{
35public:
36 OrientationAnimation(const sp<SurfaceFlinger>& flinger);
37 virtual ~OrientationAnimation();
38
39 void onOrientationChanged();
40 void onAnimationFinished();
41 inline bool run() {
42 if (LIKELY(mState == DONE))
43 return false;
44 return run_impl();
45 }
46
47private:
48 enum {
49 DONE = 0,
50 PREPARE,
51 PHASE1,
52 PHASE2,
53 FINISH
54 };
55
56 bool run_impl();
57 bool done();
58 bool prepare();
59 bool phase1();
60 bool phase2();
61 bool finished();
62
63 sp<SurfaceFlinger> mFlinger;
64 sp<MemoryDealer> mTemporaryDealer;
Mathias Agopianecbeaa02009-03-27 15:36:09 -070065 LayerOrientationAnimBase* mLayerOrientationAnim;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080066 int mState;
67};
68
69// ---------------------------------------------------------------------------
70
71}; // namespace android
72
73#endif // ANDROID_ORIENTATION_ANIMATION_H