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; } | |
65 | 64 |
66 private: | 65 private: |
67 void interpolate(const InterpolableValue& to, const double progress, Interpo
lableValue& result) const final; | 66 void interpolate(const InterpolableValue& to, const double progress, Interpo
lableValue& result) const final; |
68 double m_value; | 67 double m_value; |
69 | 68 |
70 explicit InterpolableNumber(double value) | 69 explicit InterpolableNumber(double value) |
71 : m_value(value) | 70 : m_value(value) |
72 { | 71 { |
73 } | 72 } |
74 | 73 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 }; | 189 }; |
191 | 190 |
192 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); | 191 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); |
193 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); | 192 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); |
194 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); | 193 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); |
195 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); | 194 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); |
196 | 195 |
197 } // namespace blink | 196 } // namespace blink |
198 | 197 |
199 #endif | 198 #endif |
OLD | NEW |