2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef AndroidAnimation_h
18 #define AndroidAnimation_h
20 #if USE(ACCELERATED_COMPOSITING)
22 #include "FloatPoint.h"
23 #include "FloatPoint3D.h"
24 #include "GraphicsLayer.h"
26 #include "LayerAndroid.h"
29 #include "TransformOperation.h"
36 class AndroidAnimation : public ThreadSafeRefCounted<AndroidAnimation> {
38 AndroidAnimation(AnimatedPropertyID type,
39 const Animation* animation,
40 KeyframeValueList* operations,
43 virtual ~AndroidAnimation();
44 void suggestBeginTime(double time);
45 double elapsedTime(double time);
46 void pickValues(double progress, int* start, int* end);
47 bool checkIterationsAndProgress(double time, float* finalProgress);
48 double applyTimingFunction(float from, float to, double progress,
49 const TimingFunction* timingFunction);
50 bool evaluate(LayerAndroid* layer, double time);
51 virtual void applyForProgress(LayerAndroid* layer, float progress) = 0;
52 static long instancesCount();
53 void setName(const String& name) { m_name = name; }
54 String name() { return m_name; }
55 AnimatedPropertyID type() { return m_type; }
56 bool fillsBackwards() { return m_fillsBackwards; }
57 bool fillsForwards() { return m_fillsForwards; }
58 int uniqueId() { return m_uniqueId; }
63 bool m_fillsBackwards;
67 RefPtr<TimingFunction> m_timingFunction;
69 AnimatedPropertyID m_type;
70 KeyframeValueList* m_operations;
75 class AndroidOpacityAnimation : public AndroidAnimation {
77 static PassRefPtr<AndroidOpacityAnimation> create(const Animation* animation,
78 KeyframeValueList* operations,
80 AndroidOpacityAnimation(const Animation* animation,
81 KeyframeValueList* operations,
84 virtual void applyForProgress(LayerAndroid* layer, float progress);
87 class AndroidTransformAnimation : public AndroidAnimation {
89 static PassRefPtr<AndroidTransformAnimation> create(
90 const Animation* animation,
91 KeyframeValueList* operations,
93 AndroidTransformAnimation(const Animation* animation,
94 KeyframeValueList* operations,
97 virtual void applyForProgress(LayerAndroid* layer, float progress);
100 } // namespace WebCore
103 #endif // USE(ACCELERATED_COMPOSITING)
105 #endif // AndroidAnimation_h