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/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/animatable/AnimatableValue.h" | 9 #include "core/animation/animatable/AnimatableValue.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return adoptPtr(new InterpolableNumber(value)); | 54 return adoptPtr(new InterpolableNumber(value)); |
55 } | 55 } |
56 | 56 |
57 bool isNumber() const final { return true; } | 57 bool isNumber() const final { return true; } |
58 double value() const { return m_value; } | 58 double value() const { return m_value; } |
59 bool equals(const InterpolableValue& other) const final; | 59 bool equals(const InterpolableValue& other) const final; |
60 PassOwnPtr<InterpolableValue> clone() const final { return create(m_value);
} | 60 PassOwnPtr<InterpolableValue> clone() const final { return create(m_value);
} |
61 PassOwnPtr<InterpolableValue> cloneAndZero() const final { return create(0);
} | 61 PassOwnPtr<InterpolableValue> cloneAndZero() const final { return create(0);
} |
62 void scale(double scale) final; | 62 void scale(double scale) final; |
63 void scaleAndAdd(double scale, const InterpolableValue& other) final; | 63 void scaleAndAdd(double scale, const InterpolableValue& other) final; |
| 64 void set(double value) { m_value = value; } |
64 | 65 |
65 private: | 66 private: |
66 void interpolate(const InterpolableValue& to, const double progress, Interpo
lableValue& result) const final; | 67 void interpolate(const InterpolableValue& to, const double progress, Interpo
lableValue& result) const final; |
67 double m_value; | 68 double m_value; |
68 | 69 |
69 explicit InterpolableNumber(double value) | 70 explicit InterpolableNumber(double value) |
70 : m_value(value) | 71 : m_value(value) |
71 { | 72 { |
72 } | 73 } |
73 | 74 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 }; | 190 }; |
190 | 191 |
191 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); | 192 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); |
192 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); | 193 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); |
193 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); | 194 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); |
194 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); | 195 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); |
195 | 196 |
196 } // namespace blink | 197 } // namespace blink |
197 | 198 |
198 #endif | 199 #endif |
OLD | NEW |