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 InvalidatableInterpolation_h | 5 #ifndef InvalidatableInterpolation_h |
6 #define InvalidatableInterpolation_h | 6 #define InvalidatableInterpolation_h |
7 | 7 |
8 #include "core/animation/Interpolation.h" | 8 #include "core/animation/Interpolation.h" |
9 #include "core/animation/InterpolationType.h" | 9 #include "core/animation/InterpolationType.h" |
10 #include "core/animation/InterpolationTypesMap.h" | 10 #include "core/animation/InterpolationTypesMap.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 PropertyHandle property, | 23 PropertyHandle property, |
24 PassRefPtr<PropertySpecificKeyframe> startKeyframe, | 24 PassRefPtr<PropertySpecificKeyframe> startKeyframe, |
25 PassRefPtr<PropertySpecificKeyframe> endKeyframe) { | 25 PassRefPtr<PropertySpecificKeyframe> endKeyframe) { |
26 return adoptRef(new InvalidatableInterpolation( | 26 return adoptRef(new InvalidatableInterpolation( |
27 property, std::move(startKeyframe), std::move(endKeyframe))); | 27 property, std::move(startKeyframe), std::move(endKeyframe))); |
28 } | 28 } |
29 | 29 |
30 PropertyHandle getProperty() const final { return m_property; } | 30 PropertyHandle getProperty() const final { return m_property; } |
31 virtual void interpolate(int iteration, double fraction); | 31 virtual void interpolate(int iteration, double fraction); |
32 bool dependsOnUnderlyingValue() const final; | 32 bool dependsOnUnderlyingValue() const final; |
33 virtual void apply(InterpolationEnvironment&) const { NOTREACHED(); } | |
34 static void applyStack(const ActiveInterpolations&, | 33 static void applyStack(const ActiveInterpolations&, |
35 InterpolationEnvironment&); | 34 InterpolationEnvironment&); |
36 | 35 |
37 virtual bool isInvalidatableInterpolation() const { return true; } | 36 virtual bool isInvalidatableInterpolation() const { return true; } |
38 | 37 |
39 private: | 38 private: |
40 InvalidatableInterpolation(PropertyHandle property, | 39 InvalidatableInterpolation(PropertyHandle property, |
41 PassRefPtr<PropertySpecificKeyframe> startKeyframe, | 40 PassRefPtr<PropertySpecificKeyframe> startKeyframe, |
42 PassRefPtr<PropertySpecificKeyframe> endKeyframe) | 41 PassRefPtr<PropertySpecificKeyframe> endKeyframe) |
43 : Interpolation(), | 42 : Interpolation(), |
44 m_property(property), | 43 m_property(property), |
45 m_interpolationTypes(nullptr), | 44 m_interpolationTypes(nullptr), |
46 m_interpolationTypesVersion(0), | 45 m_interpolationTypesVersion(0), |
47 m_startKeyframe(startKeyframe), | 46 m_startKeyframe(startKeyframe), |
48 m_endKeyframe(endKeyframe), | 47 m_endKeyframe(endKeyframe), |
49 m_currentFraction(std::numeric_limits<double>::quiet_NaN()), | 48 m_currentFraction(std::numeric_limits<double>::quiet_NaN()), |
50 m_isConversionCached(false) {} | 49 m_isConversionCached(false) {} |
51 | 50 |
52 using ConversionCheckers = InterpolationType::ConversionCheckers; | 51 using ConversionCheckers = InterpolationType::ConversionCheckers; |
53 | 52 |
54 InterpolableValue* getCachedValueForTesting() const final { | |
55 // TODO(suzyh): Add meaningful implementation here | |
56 NOTREACHED(); | |
57 return nullptr; | |
58 } | |
59 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue( | 53 std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue( |
60 const InterpolationEnvironment&) const; | 54 const InterpolationEnvironment&) const; |
61 const TypedInterpolationValue* ensureValidConversion( | 55 const TypedInterpolationValue* ensureValidConversion( |
62 const InterpolationEnvironment&, | 56 const InterpolationEnvironment&, |
63 const UnderlyingValueOwner&) const; | 57 const UnderlyingValueOwner&) const; |
64 void ensureValidInterpolationTypes(const InterpolationEnvironment&) const; | 58 void ensureValidInterpolationTypes(const InterpolationEnvironment&) const; |
65 void clearConversionCache() const; | 59 void clearConversionCache() const; |
66 bool isConversionCacheValid(const InterpolationEnvironment&, | 60 bool isConversionCacheValid(const InterpolationEnvironment&, |
67 const UnderlyingValueOwner&) const; | 61 const UnderlyingValueOwner&) const; |
68 bool isNeutralKeyframeActive() const; | 62 bool isNeutralKeyframeActive() const; |
(...skipping 23 matching lines...) Expand all Loading... |
92 | 86 |
93 DEFINE_TYPE_CASTS(InvalidatableInterpolation, | 87 DEFINE_TYPE_CASTS(InvalidatableInterpolation, |
94 Interpolation, | 88 Interpolation, |
95 value, | 89 value, |
96 value->isInvalidatableInterpolation(), | 90 value->isInvalidatableInterpolation(), |
97 value.isInvalidatableInterpolation()); | 91 value.isInvalidatableInterpolation()); |
98 | 92 |
99 } // namespace blink | 93 } // namespace blink |
100 | 94 |
101 #endif // InvalidatableInterpolation_h | 95 #endif // InvalidatableInterpolation_h |
OLD | NEW |