OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/animation/InterpolableValue.h" | 5 #include "core/animation/InterpolableValue.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 namespace blink { | 9 namespace blink { |
8 | 10 |
9 bool InterpolableNumber::equals(const InterpolableValue& other) const | 11 bool InterpolableNumber::equals(const InterpolableValue& other) const |
10 { | 12 { |
11 return m_value == toInterpolableNumber(other).m_value; | 13 return m_value == toInterpolableNumber(other).m_value; |
12 } | 14 } |
13 | 15 |
14 bool InterpolableList::equals(const InterpolableValue& other) const | 16 bool InterpolableList::equals(const InterpolableValue& other) const |
15 { | 17 { |
16 const InterpolableList& otherList = toInterpolableList(other); | 18 const InterpolableList& otherList = toInterpolableList(other); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ASSERT(toList.m_size == m_size); | 57 ASSERT(toList.m_size == m_size); |
56 ASSERT(resultList.m_size == m_size); | 58 ASSERT(resultList.m_size == m_size); |
57 | 59 |
58 for (size_t i = 0; i < m_size; i++) { | 60 for (size_t i = 0; i < m_size; i++) { |
59 ASSERT(m_values[i]); | 61 ASSERT(m_values[i]); |
60 ASSERT(toList.m_values[i]); | 62 ASSERT(toList.m_values[i]); |
61 m_values[i]->interpolate(*(toList.m_values[i]), progress, *(resultList.m
_values[i])); | 63 m_values[i]->interpolate(*(toList.m_values[i]), progress, *(resultList.m
_values[i])); |
62 } | 64 } |
63 } | 65 } |
64 | 66 |
65 PassOwnPtr<InterpolableValue> InterpolableList::cloneAndZero() const | 67 std::unique_ptr<InterpolableValue> InterpolableList::cloneAndZero() const |
66 { | 68 { |
67 OwnPtr<InterpolableList> result = InterpolableList::create(m_size); | 69 std::unique_ptr<InterpolableList> result = InterpolableList::create(m_size); |
68 for (size_t i = 0; i < m_size; i++) | 70 for (size_t i = 0; i < m_size; i++) |
69 result->set(i, m_values[i]->cloneAndZero()); | 71 result->set(i, m_values[i]->cloneAndZero()); |
70 return std::move(result); | 72 return std::move(result); |
71 } | 73 } |
72 | 74 |
73 void InterpolableNumber::scale(double scale) | 75 void InterpolableNumber::scale(double scale) |
74 { | 76 { |
75 m_value = m_value * scale; | 77 m_value = m_value * scale; |
76 } | 78 } |
77 | 79 |
(...skipping 21 matching lines...) Expand all Loading... |
99 const InterpolableAnimatableValue& toValue = toInterpolableAnimatableValue(t
o); | 101 const InterpolableAnimatableValue& toValue = toInterpolableAnimatableValue(t
o); |
100 InterpolableAnimatableValue& resultValue = toInterpolableAnimatableValue(res
ult); | 102 InterpolableAnimatableValue& resultValue = toInterpolableAnimatableValue(res
ult); |
101 if (progress == 0) | 103 if (progress == 0) |
102 resultValue.m_value = m_value; | 104 resultValue.m_value = m_value; |
103 if (progress == 1) | 105 if (progress == 1) |
104 resultValue.m_value = toValue.m_value; | 106 resultValue.m_value = toValue.m_value; |
105 resultValue.m_value = AnimatableValue::interpolate(m_value.get(), toValue.m_
value.get(), progress); | 107 resultValue.m_value = AnimatableValue::interpolate(m_value.get(), toValue.m_
value.get(), progress); |
106 } | 108 } |
107 | 109 |
108 } // namespace blink | 110 } // namespace blink |
OLD | NEW |