OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 InterpolationType_h | 5 #ifndef InterpolationType_h |
6 #define InterpolationType_h | 6 #define InterpolationType_h |
7 | 7 |
8 #include "core/animation/InterpolationValue.h" | 8 #include "core/animation/InterpolationValue.h" |
9 #include "core/animation/Keyframe.h" | 9 #include "core/animation/Keyframe.h" |
10 #include "core/animation/PairwiseInterpolationValue.h" | 10 #include "core/animation/PairwiseInterpolationValue.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 { | 53 { |
54 InterpolationValue start = maybeConvertSingle(startKeyframe, environment
, underlying, conversionCheckers); | 54 InterpolationValue start = maybeConvertSingle(startKeyframe, environment
, underlying, conversionCheckers); |
55 if (!start) | 55 if (!start) |
56 return nullptr; | 56 return nullptr; |
57 InterpolationValue end = maybeConvertSingle(endKeyframe, environment, un
derlying, conversionCheckers); | 57 InterpolationValue end = maybeConvertSingle(endKeyframe, environment, un
derlying, conversionCheckers); |
58 if (!end) | 58 if (!end) |
59 return nullptr; | 59 return nullptr; |
60 return maybeMergeSingles(std::move(start), std::move(end)); | 60 return maybeMergeSingles(std::move(start), std::move(end)); |
61 } | 61 } |
62 | 62 |
| 63 virtual PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& st
art, InterpolationValue&& end) const |
| 64 { |
| 65 DCHECK(!start.nonInterpolableValue); |
| 66 DCHECK(!end.nonInterpolableValue); |
| 67 return PairwiseInterpolationValue( |
| 68 std::move(start.interpolableValue), |
| 69 std::move(end.interpolableValue), |
| 70 nullptr); |
| 71 } |
| 72 |
63 virtual InterpolationValue maybeConvertSingle(const PropertySpecificKeyframe
&, const InterpolationEnvironment&, const InterpolationValue& underlying, Conver
sionCheckers&) const = 0; | 73 virtual InterpolationValue maybeConvertSingle(const PropertySpecificKeyframe
&, const InterpolationEnvironment&, const InterpolationValue& underlying, Conver
sionCheckers&) const = 0; |
64 | 74 |
65 virtual InterpolationValue maybeConvertUnderlyingValue(const InterpolationEn
vironment&) const = 0; | 75 virtual InterpolationValue maybeConvertUnderlyingValue(const InterpolationEn
vironment&) const = 0; |
66 | 76 |
67 virtual void composite(UnderlyingValueOwner& underlyingValueOwner, double un
derlyingFraction, const InterpolationValue& value, double interpolationFraction)
const | 77 virtual void composite(UnderlyingValueOwner& underlyingValueOwner, double un
derlyingFraction, const InterpolationValue& value, double interpolationFraction)
const |
68 { | 78 { |
69 ASSERT(!underlyingValueOwner.value().nonInterpolableValue); | 79 DCHECK(!underlyingValueOwner.value().nonInterpolableValue); |
70 ASSERT(!value.nonInterpolableValue); | 80 DCHECK(!value.nonInterpolableValue); |
71 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(under
lyingFraction, *value.interpolableValue); | 81 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(under
lyingFraction, *value.interpolableValue); |
72 } | 82 } |
73 | 83 |
74 virtual void apply(const InterpolableValue&, const NonInterpolableValue*, In
terpolationEnvironment&) const = 0; | 84 virtual void apply(const InterpolableValue&, const NonInterpolableValue*, In
terpolationEnvironment&) const = 0; |
75 | 85 |
76 // Implement reference equality checking via pointer equality checking as th
ese are singletons. | 86 // Implement reference equality checking via pointer equality checking as th
ese are singletons. |
77 bool operator==(const InterpolationType& other) const { return this == &othe
r; } | 87 bool operator==(const InterpolationType& other) const { return this == &othe
r; } |
78 bool operator!=(const InterpolationType& other) const { return this != &othe
r; } | 88 bool operator!=(const InterpolationType& other) const { return this != &othe
r; } |
79 | 89 |
80 protected: | 90 protected: |
81 InterpolationType(PropertyHandle property) | 91 InterpolationType(PropertyHandle property) |
82 : m_property(property) | 92 : m_property(property) |
83 { } | 93 { } |
84 | 94 |
85 virtual PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& st
art, InterpolationValue&& end) const | |
86 { | |
87 ASSERT(!start.nonInterpolableValue); | |
88 ASSERT(!end.nonInterpolableValue); | |
89 return PairwiseInterpolationValue( | |
90 std::move(start.interpolableValue), | |
91 std::move(end.interpolableValue), | |
92 nullptr); | |
93 } | |
94 | |
95 const PropertyHandle m_property; | 95 const PropertyHandle m_property; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace blink | 98 } // namespace blink |
99 | 99 |
100 #endif // InterpolationType_h | 100 #endif // InterpolationType_h |
OLD | NEW |