| 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 #ifndef Interpolation_h | 5 #ifndef Interpolation_h |
| 6 #define Interpolation_h | 6 #define Interpolation_h |
| 7 | 7 |
| 8 #include "core/animation/InterpolableValue.h" | 8 #include "core/animation/InterpolableValue.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class Interpolation : public RefCounted<Interpolation> { | 13 class Interpolation : public RefCounted<Interpolation> { |
| 14 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(Interpolation); | 14 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(Interpolation); |
| 15 public: | 15 public: |
| 16 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) | 16 static PassRefPtr<Interpolation> create(PassOwnPtr<InterpolableValue> start,
PassOwnPtr<InterpolableValue> end) |
| 17 { | 17 { |
| 18 return adoptRef(new Interpolation(start, end)); | 18 return adoptRef(new Interpolation(start, end)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void interpolate(int iteration, double fraction) const; | 21 void interpolate(int iteration, double fraction) const; |
| 22 | 22 |
| 23 virtual bool isStyleInterpolation() const { return false; } | 23 virtual bool isStyleInterpolation() const { return false; } |
| 24 virtual bool isLegacyStyleInterpolation() const { return false; } | 24 virtual bool isLegacyStyleInterpolation() const { return false; } |
| 25 | 25 |
| 26 virtual void trace(Visitor*); | |
| 27 | |
| 28 protected: | 26 protected: |
| 29 const OwnPtr<InterpolableValue> m_start; | 27 const OwnPtr<InterpolableValue> m_start; |
| 30 const OwnPtr<InterpolableValue> m_end; | 28 const OwnPtr<InterpolableValue> m_end; |
| 31 | 29 |
| 32 mutable double m_cachedFraction; | 30 mutable double m_cachedFraction; |
| 33 mutable int m_cachedIteration; | 31 mutable int m_cachedIteration; |
| 34 mutable OwnPtr<InterpolableValue> m_cachedValue; | 32 mutable OwnPtr<InterpolableValue> m_cachedValue; |
| 35 | 33 |
| 36 Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableVa
lue> end); | 34 Interpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableVa
lue> end); |
| 37 | 35 |
| 38 private: | 36 private: |
| 39 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } | 37 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } |
| 40 | 38 |
| 41 friend class AnimationInterpolableValueTest; | 39 friend class AnimationInterpolableValueTest; |
| 42 friend class AnimationInterpolationEffectTest; | 40 friend class AnimationInterpolationEffectTest; |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 } | 43 } |
| 46 | 44 |
| 47 #endif | 45 #endif |
| OLD | NEW |