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 #ifndef InterpolableValue_h | 5 #ifndef InterpolableValue_h |
6 #define InterpolableValue_h | 6 #define InterpolableValue_h |
7 | 7 |
8 #include "core/animation/AnimatableValue.h" | 8 #include "core/animation/AnimatableValue.h" |
9 #include "wtf/OwnPtr.h" | 9 #include "wtf/OwnPtr.h" |
10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 size_t length() const { return m_size; } | 110 size_t length() const { return m_size; } |
111 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const OVERRIDE FIN
AL { return create(*this); } | 111 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const OVERRIDE FIN
AL { return create(*this); } |
112 | 112 |
113 virtual void trace(Visitor*) OVERRIDE; | 113 virtual void trace(Visitor*) OVERRIDE; |
114 | 114 |
115 private: | 115 private: |
116 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> interpolate(const Interpol
ableValue &other, const double progress) const OVERRIDE FINAL; | 116 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> interpolate(const Interpol
ableValue &other, const double progress) const OVERRIDE FINAL; |
117 explicit InterpolableList(size_t size) | 117 explicit InterpolableList(size_t size) |
118 : m_size(size) | 118 : m_size(size) |
| 119 , m_values(m_size) |
119 { | 120 { |
120 m_values.reserveCapacity(m_size); | |
121 m_values.resize(m_size); | |
122 } | 121 } |
123 | 122 |
124 InterpolableList(const InterpolableList& other) | 123 InterpolableList(const InterpolableList& other) |
125 : m_size(other.m_size) | 124 : m_size(other.m_size) |
| 125 , m_values(m_size) |
126 { | 126 { |
127 m_values.reserveCapacity(m_size); | |
128 m_values.resize(m_size); | |
129 for (size_t i = 0; i < m_size; i++) | 127 for (size_t i = 0; i < m_size; i++) |
130 set(i, other.m_values[i]->clone()); | 128 set(i, other.m_values[i]->clone()); |
131 } | 129 } |
132 | 130 |
133 size_t m_size; | 131 size_t m_size; |
134 WillBeHeapVector<OwnPtrWillBeMember<InterpolableValue> > m_values; | 132 WillBeHeapVector<OwnPtrWillBeMember<InterpolableValue> > m_values; |
135 }; | 133 }; |
136 | 134 |
137 // FIXME: Remove this when we can. | 135 // FIXME: Remove this when we can. |
138 class InterpolableAnimatableValue : public InterpolableValue { | 136 class InterpolableAnimatableValue : public InterpolableValue { |
(...skipping 20 matching lines...) Expand all Loading... |
159 }; | 157 }; |
160 | 158 |
161 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); | 159 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); |
162 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); | 160 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); |
163 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); | 161 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); |
164 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); | 162 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); |
165 | 163 |
166 } | 164 } |
167 | 165 |
168 #endif | 166 #endif |
OLD | NEW |