| 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 #include "core/animation/Interpolation.h" | 5 #include "core/animation/Interpolation.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const InterpolableList* endList = toInterpolableList(end); | 24 const InterpolableList* endList = toInterpolableList(end); |
| 25 if (startList->length() != endList->length()) | 25 if (startList->length() != endList->length()) |
| 26 return false; | 26 return false; |
| 27 for (size_t i = 0; i < startList->length(); ++i) { | 27 for (size_t i = 0; i < startList->length(); ++i) { |
| 28 if (!typesMatch(startList->get(i), endList->get(i))) | 28 if (!typesMatch(startList->get(i), endList->get(i))) |
| 29 return false; | 29 return false; |
| 30 } | 30 } |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 } | 34 } // namespace |
| 35 | 35 |
| 36 Interpolation::Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end) | 36 Interpolation::Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end) |
| 37 : m_start(start) | 37 : m_start(start) |
| 38 , m_end(end) | 38 , m_end(end) |
| 39 , m_cachedFraction(0) | 39 , m_cachedFraction(0) |
| 40 , m_cachedIteration(0) | 40 , m_cachedIteration(0) |
| 41 , m_cachedValue(m_start ? m_start->clone() : nullptr) | 41 , m_cachedValue(m_start ? m_start->clone() : nullptr) |
| 42 { | 42 { |
| 43 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); | 43 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); |
| 44 } | 44 } |
| 45 | 45 |
| 46 Interpolation::~Interpolation() | 46 Interpolation::~Interpolation() |
| 47 { | 47 { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Interpolation::interpolate(int iteration, double fraction) | 50 void Interpolation::interpolate(int iteration, double fraction) |
| 51 { | 51 { |
| 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 } | 59 } // namespace blink |
| OLD | NEW |