| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "core/animation/LegacyStyleInterpolation.h" | 5 #include "core/animation/LegacyStyleInterpolation.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 LegacyStyleInterpolation::LegacyStyleInterpolation( | 37 LegacyStyleInterpolation::LegacyStyleInterpolation( |
| 38 std::unique_ptr<InterpolableValue> start, | 38 std::unique_ptr<InterpolableValue> start, |
| 39 std::unique_ptr<InterpolableValue> end, | 39 std::unique_ptr<InterpolableValue> end, |
| 40 CSSPropertyID id) | 40 CSSPropertyID id) |
| 41 : Interpolation(), | 41 : Interpolation(), |
| 42 m_start(std::move(start)), | 42 m_start(std::move(start)), |
| 43 m_end(std::move(end)), | 43 m_end(std::move(end)), |
| 44 m_id(id), | 44 m_property(id), |
| 45 m_cachedFraction(0), | 45 m_cachedFraction(0), |
| 46 m_cachedIteration(0), | 46 m_cachedIteration(0), |
| 47 m_cachedValue(m_start ? m_start->clone() : nullptr) { | 47 m_cachedValue(m_start ? m_start->clone() : nullptr) { |
| 48 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); | 48 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void LegacyStyleInterpolation::interpolate(int iteration, double fraction) { | 51 void LegacyStyleInterpolation::interpolate(int iteration, double fraction) { |
| 52 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { | 52 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { |
| 53 m_start->interpolate(*m_end, fraction, *m_cachedValue); | 53 m_start->interpolate(*m_end, fraction, *m_cachedValue); |
| 54 m_cachedIteration = iteration; | 54 m_cachedIteration = iteration; |
| 55 m_cachedFraction = fraction; | 55 m_cachedFraction = fraction; |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| OLD | NEW |