OSDN Git Service

Delete TextureGenerator operations outside the lock
[android-x86/external-webkit.git] / Source / WebCore / platform / graphics / android / AndroidAnimation.h
1 /*
2  * Copyright (C) 2009 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 AndroidAnimation_h
18 #define AndroidAnimation_h
19
20 #if USE(ACCELERATED_COMPOSITING)
21
22 #include "FloatPoint.h"
23 #include "FloatPoint3D.h"
24 #include "GraphicsLayer.h"
25 #include "HashMap.h"
26 #include "LayerAndroid.h"
27 #include "RefPtr.h"
28 #include "Timer.h"
29 #include "TransformOperation.h"
30 #include "Vector.h"
31
32 namespace WebCore {
33
34 class TimingFunction;
35
36 class AndroidAnimation : public RefCounted<AndroidAnimation> {
37 public:
38     AndroidAnimation(AnimatedPropertyID type,
39                      const Animation* animation,
40                      KeyframeValueList* operations,
41                      double beginTime);
42     AndroidAnimation(AndroidAnimation* anim);
43
44     virtual ~AndroidAnimation();
45     virtual PassRefPtr<AndroidAnimation> copy() = 0;
46     void suggestBeginTime(double time);
47     double elapsedTime(double time);
48     void pickValues(double progress, int* start, int* end);
49     bool checkIterationsAndProgress(double time, float* finalProgress);
50     double applyTimingFunction(float from, float to, double progress,
51                                const TimingFunction* timingFunction);
52     bool evaluate(LayerAndroid* layer, double time);
53     virtual void applyForProgress(LayerAndroid* layer, float progress) = 0;
54     static long instancesCount();
55     void setName(const String& name) { m_name = name; }
56     String name() { return m_name; }
57     AnimatedPropertyID type() { return m_type; }
58     bool fillsBackwards() { return m_fillsBackwards; }
59     bool fillsForwards() { return m_fillsForwards; }
60     int uniqueId() { return m_uniqueId; }
61
62     double beginTime() { return m_beginTime; }
63
64 protected:
65     double m_beginTime;
66     double m_duration;
67     bool m_fillsBackwards;
68     bool m_fillsForwards;
69     int m_iterationCount;
70     int m_direction;
71     RefPtr<TimingFunction> m_timingFunction;
72     String m_name;
73     AnimatedPropertyID m_type;
74     KeyframeValueList* m_operations;
75     int m_uniqueId;
76     bool m_hasFinished;
77 };
78
79 class AndroidOpacityAnimation : public AndroidAnimation {
80 public:
81     static PassRefPtr<AndroidOpacityAnimation> create(const Animation* animation,
82                                                       KeyframeValueList* operations,
83                                                       double beginTime);
84     AndroidOpacityAnimation(const Animation* animation,
85                             KeyframeValueList* operations,
86                             double beginTime);
87     AndroidOpacityAnimation(AndroidOpacityAnimation* anim);
88     virtual PassRefPtr<AndroidAnimation> copy();
89
90     virtual void applyForProgress(LayerAndroid* layer, float progress);
91 };
92
93 class AndroidTransformAnimation : public AndroidAnimation {
94 public:
95     static PassRefPtr<AndroidTransformAnimation> create(
96                                                      const Animation* animation,
97                                                      KeyframeValueList* operations,
98                                                      double beginTime);
99     AndroidTransformAnimation(const Animation* animation,
100                               KeyframeValueList* operations,
101                               double beginTime);
102
103     AndroidTransformAnimation(AndroidTransformAnimation* anim);
104     virtual PassRefPtr<AndroidAnimation> copy();
105
106     virtual void applyForProgress(LayerAndroid* layer, float progress);
107 };
108
109 } // namespace WebCore
110
111
112 #endif // USE(ACCELERATED_COMPOSITING)
113
114 #endif // AndroidAnimation_h