Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolableValue.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
9 namespace blink { 7 namespace blink {
10 8
11 bool InterpolableNumber::equals(const InterpolableValue& other) const 9 bool InterpolableNumber::equals(const InterpolableValue& other) const
12 { 10 {
13 return m_value == toInterpolableNumber(other).m_value; 11 return m_value == toInterpolableNumber(other).m_value;
14 } 12 }
15 13
16 bool InterpolableList::equals(const InterpolableValue& other) const 14 bool InterpolableList::equals(const InterpolableValue& other) const
17 { 15 {
18 const InterpolableList& otherList = toInterpolableList(other); 16 const InterpolableList& otherList = toInterpolableList(other);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ASSERT(toList.m_size == m_size); 55 ASSERT(toList.m_size == m_size);
58 ASSERT(resultList.m_size == m_size); 56 ASSERT(resultList.m_size == m_size);
59 57
60 for (size_t i = 0; i < m_size; i++) { 58 for (size_t i = 0; i < m_size; i++) {
61 ASSERT(m_values[i]); 59 ASSERT(m_values[i]);
62 ASSERT(toList.m_values[i]); 60 ASSERT(toList.m_values[i]);
63 m_values[i]->interpolate(*(toList.m_values[i]), progress, *(resultList.m _values[i])); 61 m_values[i]->interpolate(*(toList.m_values[i]), progress, *(resultList.m _values[i]));
64 } 62 }
65 } 63 }
66 64
67 std::unique_ptr<InterpolableValue> InterpolableList::cloneAndZero() const 65 PassOwnPtr<InterpolableValue> InterpolableList::cloneAndZero() const
68 { 66 {
69 std::unique_ptr<InterpolableList> result = InterpolableList::create(m_size); 67 OwnPtr<InterpolableList> result = InterpolableList::create(m_size);
70 for (size_t i = 0; i < m_size; i++) 68 for (size_t i = 0; i < m_size; i++)
71 result->set(i, m_values[i]->cloneAndZero()); 69 result->set(i, m_values[i]->cloneAndZero());
72 return std::move(result); 70 return std::move(result);
73 } 71 }
74 72
75 void InterpolableNumber::scale(double scale) 73 void InterpolableNumber::scale(double scale)
76 { 74 {
77 m_value = m_value * scale; 75 m_value = m_value * scale;
78 } 76 }
79 77
(...skipping 21 matching lines...) Expand all
101 const InterpolableAnimatableValue& toValue = toInterpolableAnimatableValue(t o); 99 const InterpolableAnimatableValue& toValue = toInterpolableAnimatableValue(t o);
102 InterpolableAnimatableValue& resultValue = toInterpolableAnimatableValue(res ult); 100 InterpolableAnimatableValue& resultValue = toInterpolableAnimatableValue(res ult);
103 if (progress == 0) 101 if (progress == 0)
104 resultValue.m_value = m_value; 102 resultValue.m_value = m_value;
105 if (progress == 1) 103 if (progress == 1)
106 resultValue.m_value = toValue.m_value; 104 resultValue.m_value = toValue.m_value;
107 resultValue.m_value = AnimatableValue::interpolate(m_value.get(), toValue.m_ value.get(), progress); 105 resultValue.m_value = AnimatableValue::interpolate(m_value.get(), toValue.m_ value.get(), progress);
108 } 106 }
109 107
110 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698