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 "config.h" | 5 #include "config.h" |
6 #include "core/animation/Interpolation.h" | 6 #include "core/animation/Interpolation.h" |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 16 matching lines...) Expand all Loading... |
27 return false; | 27 return false; |
28 for (size_t i = 0; i < startList->length(); ++i) { | 28 for (size_t i = 0; i < startList->length(); ++i) { |
29 if (!typesMatch(startList->get(i), endList->get(i))) | 29 if (!typesMatch(startList->get(i), endList->get(i))) |
30 return false; | 30 return false; |
31 } | 31 } |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 } | 35 } |
36 | 36 |
37 Interpolation::Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end) | 37 Interpolation::Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end) |
38 : m_start(start) | 38 : m_start(start) |
39 , m_end(end) | 39 , m_end(end) |
40 , m_cachedFraction(0) | 40 , m_cachedFraction(0) |
41 , m_cachedIteration(0) | 41 , m_cachedIteration(0) |
42 , m_cachedValue(m_start ? m_start->clone() : nullptr) | 42 , m_cachedValue(m_start ? m_start->clone() : nullptr) |
43 { | 43 { |
44 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); | 44 RELEASE_ASSERT(typesMatch(m_start.get(), m_end.get())); |
45 } | 45 } |
46 | 46 |
47 Interpolation::~Interpolation() | 47 Interpolation::~Interpolation() |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 void Interpolation::interpolate(int iteration, double fraction) | 51 void Interpolation::interpolate(int iteration, double fraction) |
52 { | 52 { |
53 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { | 53 if (m_cachedFraction != fraction || m_cachedIteration != iteration) { |
54 m_start->interpolate(*m_end, fraction, *m_cachedValue); | 54 m_start->interpolate(*m_end, fraction, *m_cachedValue); |
55 m_cachedIteration = iteration; | 55 m_cachedIteration = iteration; |
56 m_cachedFraction = fraction; | 56 m_cachedFraction = fraction; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 DEFINE_TRACE(Interpolation) | |
61 { | |
62 visitor->trace(m_start); | |
63 visitor->trace(m_end); | |
64 visitor->trace(m_cachedValue); | |
65 } | 60 } |
66 | |
67 } | |
OLD | NEW |