| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/animation/CompositorAnimation.h" | 5 #include "platform/animation/CompositorAnimation.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 7 #include "cc/animation/animation_curve.h" | 8 #include "cc/animation/animation_curve.h" |
| 8 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
| 10 #include "cc/animation/keyframed_animation_curve.h" |
| 9 #include "platform/animation/CompositorAnimationCurve.h" | 11 #include "platform/animation/CompositorAnimationCurve.h" |
| 10 #include "platform/animation/CompositorFilterAnimationCurve.h" | 12 #include "platform/animation/CompositorFilterAnimationCurve.h" |
| 11 #include "platform/animation/CompositorFloatAnimationCurve.h" | 13 #include "platform/animation/CompositorFloatAnimationCurve.h" |
| 12 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" | 14 #include "platform/animation/CompositorScrollOffsetAnimationCurve.h" |
| 13 #include "platform/animation/CompositorTransformAnimationCurve.h" | 15 #include "platform/animation/CompositorTransformAnimationCurve.h" |
| 14 | 16 |
| 15 using cc::Animation; | 17 using cc::Animation; |
| 16 using cc::AnimationIdProvider; | 18 using cc::AnimationIdProvider; |
| 17 | 19 |
| 18 using blink::CompositorAnimation; | 20 using blink::CompositorAnimation; |
| 19 using blink::CompositorAnimationCurve; | 21 using blink::CompositorAnimationCurve; |
| 20 | 22 |
| 21 namespace blink { | 23 namespace blink { |
| 22 | 24 |
| 23 CompositorAnimation::CompositorAnimation(const CompositorAnimationCurve& curve,
CompositorTargetProperty::Type targetProperty, int animationId, int groupId) | 25 CompositorAnimation::CompositorAnimation(const CompositorAnimationCurve& curve,
CompositorTargetProperty::Type targetProperty, int animationId, int groupId) |
| 24 { | 26 { |
| 25 if (!animationId) | 27 if (!animationId) |
| 26 animationId = AnimationIdProvider::NextAnimationId(); | 28 animationId = AnimationIdProvider::NextAnimationId(); |
| 27 if (!groupId) | 29 if (!groupId) |
| 28 groupId = AnimationIdProvider::NextGroupId(); | 30 groupId = AnimationIdProvider::NextGroupId(); |
| 29 | 31 |
| 30 m_animation = Animation::Create(curve.cloneToAnimationCurve(), animationId,
groupId, targetProperty); | 32 m_animation = Animation::Create(curve.cloneToAnimationCurve(), animationId,
groupId, targetProperty); |
| 31 } | 33 } |
| 32 | 34 |
| 33 CompositorAnimation::CompositorAnimation() {} | |
| 34 | |
| 35 CompositorAnimation::~CompositorAnimation() {} | 35 CompositorAnimation::~CompositorAnimation() {} |
| 36 | 36 |
| 37 int CompositorAnimation::id() | 37 int CompositorAnimation::id() const |
| 38 { | 38 { |
| 39 return m_animation->id(); | 39 return m_animation->id(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 int CompositorAnimation::group() | 42 int CompositorAnimation::group() const |
| 43 { | 43 { |
| 44 return m_animation->group(); | 44 return m_animation->group(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 CompositorTargetProperty::Type CompositorAnimation::targetProperty() const | 47 CompositorTargetProperty::Type CompositorAnimation::targetProperty() const |
| 48 { | 48 { |
| 49 return m_animation->target_property(); | 49 return m_animation->target_property(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 double CompositorAnimation::iterations() const | 52 double CompositorAnimation::iterations() const |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 { | 119 { |
| 120 m_animation->set_fill_mode(fillMode); | 120 m_animation->set_fill_mode(fillMode); |
| 121 } | 121 } |
| 122 | 122 |
| 123 std::unique_ptr<cc::Animation> CompositorAnimation::passAnimation() | 123 std::unique_ptr<cc::Animation> CompositorAnimation::passAnimation() |
| 124 { | 124 { |
| 125 m_animation->set_needs_synchronized_start_time(true); | 125 m_animation->set_needs_synchronized_start_time(true); |
| 126 return std::move(m_animation); | 126 return std::move(m_animation); |
| 127 } | 127 } |
| 128 | 128 |
| 129 PassOwnPtr<CompositorFloatAnimationCurve> CompositorAnimation::floatCurveForTest
ing() const |
| 130 { |
| 131 const cc::AnimationCurve* curve = m_animation->curve(); |
| 132 DCHECK_EQ(cc::AnimationCurve::FLOAT, curve->Type()); |
| 133 |
| 134 auto keyframedCurve = base::WrapUnique(static_cast<cc::KeyframedFloatAnimati
onCurve*>(curve->Clone().release())); |
| 135 return CompositorFloatAnimationCurve::CreateForTesting(std::move(keyframedCu
rve)); |
| 136 } |
| 137 |
| 129 } // namespace blink | 138 } // namespace blink |
| OLD | NEW |