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 RefCounted<AndroidAnimation> {
38 AndroidAnimation(AnimatedPropertyID type,
39 const Animation* animation,
40 KeyframeValueList* operations,
42 AndroidAnimation(AndroidAnimation* anim);
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; }
62 double beginTime() { return m_beginTime; }
67 bool m_fillsBackwards;
71 RefPtr<TimingFunction> m_timingFunction;
73 AnimatedPropertyID m_type;
74 KeyframeValueList* m_operations;
79 class AndroidOpacityAnimation : public AndroidAnimation {
81 static PassRefPtr<AndroidOpacityAnimation> create(const Animation* animation,
82 KeyframeValueList* operations,
84 AndroidOpacityAnimation(const Animation* animation,
85 KeyframeValueList* operations,
87 AndroidOpacityAnimation(AndroidOpacityAnimation* anim);
88 virtual PassRefPtr<AndroidAnimation> copy();
90 virtual void applyForProgress(LayerAndroid* layer, float progress);
93 class AndroidTransformAnimation : public AndroidAnimation {
95 static PassRefPtr<AndroidTransformAnimation> create(
96 const Animation* animation,
97 KeyframeValueList* operations,
99 AndroidTransformAnimation(const Animation* animation,
100 KeyframeValueList* operations,
103 AndroidTransformAnimation(AndroidTransformAnimation* anim);
104 virtual PassRefPtr<AndroidAnimation> copy();
106 virtual void applyForProgress(LayerAndroid* layer, float progress);
109 } // namespace WebCore
112 #endif // USE(ACCELERATED_COMPOSITING)
114 #endif // AndroidAnimation_h