diff options
Diffstat (limited to 'WebCore/platform')
-rw-r--r-- | WebCore/platform/graphics/android/AndroidAnimation.cpp | 13 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/AndroidAnimation.h | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 3 |
3 files changed, 19 insertions, 7 deletions
diff --git a/WebCore/platform/graphics/android/AndroidAnimation.cpp b/WebCore/platform/graphics/android/AndroidAnimation.cpp index 47fc82c..3280d07 100644 --- a/WebCore/platform/graphics/android/AndroidAnimation.cpp +++ b/WebCore/platform/graphics/android/AndroidAnimation.cpp @@ -54,7 +54,8 @@ long AndroidAnimation::instancesCount() return gDebugAndroidAnimationInstances; } -AndroidAnimation::AndroidAnimation(const Animation* animation, +AndroidAnimation::AndroidAnimation(AndroidAnimationType type, + const Animation* animation, double beginTime) : m_beginTime(beginTime) , m_duration(animation->duration()) @@ -63,6 +64,7 @@ AndroidAnimation::AndroidAnimation(const Animation* animation, , m_direction(animation->direction()) , m_currentDirection(false) , m_timingFunction(animation->timingFunction()) + , m_type(type) { ASSERT(m_timingFunction); @@ -80,6 +82,7 @@ AndroidAnimation::AndroidAnimation(AndroidAnimation* anim) , m_direction(anim->m_direction) , m_currentDirection(false) , m_timingFunction(anim->m_timingFunction) + , m_type(anim->m_type) { gDebugAndroidAnimationInstances++; } @@ -147,7 +150,7 @@ PassRefPtr<AndroidOpacityAnimation> AndroidOpacityAnimation::create( AndroidOpacityAnimation::AndroidOpacityAnimation(const Animation* animation, KeyframeValueList* operations, double beginTime) - : AndroidAnimation(animation, beginTime) + : AndroidAnimation(AndroidAnimation::OPACITY, animation, beginTime) , m_operations(operations) { } @@ -231,7 +234,7 @@ PassRefPtr<AndroidTransformAnimation> AndroidTransformAnimation::create( AndroidTransformAnimation::AndroidTransformAnimation(const Animation* animation, KeyframeValueList* operations, double beginTime) - : AndroidAnimation(animation, beginTime) + : AndroidAnimation(AndroidAnimation::TRANSFORM, animation, beginTime) , m_operations(operations) { } @@ -275,9 +278,9 @@ bool AndroidTransformAnimation::evaluate(LayerAndroid* layer, double time) TransformAnimationValue* value = (TransformAnimationValue*) m_operations->at(i); TransformOperations* values = (TransformOperations*) value->value(); float key = value->keyTime(); - float d = fabs(progress - key); + float d = progress - key; XLOG("[%d] Key %.2f, %d values", i, key, values->size()); - if (!fromValue || (d < distance && i + 1 < m_operations->size())) { + if (!fromValue || (d > 0 && d < distance && i + 1 < m_operations->size())) { fromValue = value; distance = d; foundAt = i; diff --git a/WebCore/platform/graphics/android/AndroidAnimation.h b/WebCore/platform/graphics/android/AndroidAnimation.h index ed2789e..d682103 100644 --- a/WebCore/platform/graphics/android/AndroidAnimation.h +++ b/WebCore/platform/graphics/android/AndroidAnimation.h @@ -35,7 +35,13 @@ class TimingFunction; class AndroidAnimation : public RefCounted<AndroidAnimation> { public: - AndroidAnimation(const Animation* animation, + enum AndroidAnimationType { + UNDEFINED, + OPACITY, + TRANSFORM + }; + AndroidAnimation(AndroidAnimationType type, + const Animation* animation, double beginTime); AndroidAnimation(AndroidAnimation* anim); @@ -48,6 +54,7 @@ class AndroidAnimation : public RefCounted<AndroidAnimation> { static long instancesCount(); void setName(const String& name) { m_name = name; } String name() { return m_name; } + AndroidAnimationType type() { return m_type; } protected: double m_beginTime; @@ -59,6 +66,7 @@ class AndroidAnimation : public RefCounted<AndroidAnimation> { bool m_currentDirection; RefPtr<TimingFunction> m_timingFunction; String m_name; + AndroidAnimationType m_type; }; class AndroidOpacityAnimation : public AndroidAnimation { diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 714fa40..7d68f03 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -243,7 +243,8 @@ bool LayerAndroid::evaluateAnimations(double time) const void LayerAndroid::addAnimation(PassRefPtr<AndroidAnimation> prpAnim) { RefPtr<AndroidAnimation> anim = prpAnim; - if (m_animations.get(anim->name())) + RefPtr<AndroidAnimation> currentAnim = m_animations.get(anim->name()); + if (currentAnim && currentAnim->type() == anim->type()) removeAnimation(anim->name()); m_animations.add(anim->name(), anim); } |