| 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 RefCountedWillBeGarbageCollectedFinalized<Interpola
tion> { | 13 class Interpolation : public RefCountedWillBeGarbageCollectedFinalized<Interpola
tion> { |
| 14 public: | 14 public: |
| 15 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I
nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end) | 15 static PassRefPtrWillBeRawPtr<Interpolation> create(PassOwnPtrWillBeRawPtr<I
nterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end) |
| 16 { | 16 { |
| 17 return adoptRefWillBeNoop(new Interpolation(start, end)); | 17 return adoptRefWillBeNoop(new Interpolation(start, end)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 virtual ~Interpolation(); | 20 virtual ~Interpolation(); |
| 21 | 21 |
| 22 void interpolate(int iteration, double fraction) const; | 22 void interpolate(int iteration, double fraction) const; |
| 23 | 23 |
| 24 virtual bool isStyleInterpolation() const { return false; } | 24 virtual bool isStyleInterpolation() const { return false; } |
| 25 virtual bool isLegacyStyleInterpolation() const { return false; } | 25 virtual bool isLegacyStyleInterpolation() const { return false; } |
| 26 | 26 |
| 27 virtual void trace(Visitor*); | 27 DECLARE_VIRTUAL_TRACE(); |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 const OwnPtrWillBeMember<InterpolableValue> m_start; | 30 const OwnPtrWillBeMember<InterpolableValue> m_start; |
| 31 const OwnPtrWillBeMember<InterpolableValue> m_end; | 31 const OwnPtrWillBeMember<InterpolableValue> m_end; |
| 32 | 32 |
| 33 mutable double m_cachedFraction; | 33 mutable double m_cachedFraction; |
| 34 mutable int m_cachedIteration; | 34 mutable int m_cachedIteration; |
| 35 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; | 35 mutable OwnPtrWillBeMember<InterpolableValue> m_cachedValue; |
| 36 | 36 |
| 37 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil
lBeRawPtr<InterpolableValue> end); | 37 Interpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWil
lBeRawPtr<InterpolableValue> end); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } | 40 InterpolableValue* getCachedValueForTesting() const { return m_cachedValue.g
et(); } |
| 41 | 41 |
| 42 friend class AnimationInterpolableValueTest; | 42 friend class AnimationInterpolableValueTest; |
| 43 friend class AnimationInterpolationEffectTest; | 43 friend class AnimationInterpolationEffectTest; |
| 44 friend class AnimationDoubleStyleInterpolationTest; | 44 friend class AnimationDoubleStyleInterpolationTest; |
| 45 friend class AnimationVisibilityStyleInterpolationTest; | 45 friend class AnimationVisibilityStyleInterpolationTest; |
| 46 friend class AnimationColorStyleInterpolationTest; | 46 friend class AnimationColorStyleInterpolationTest; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace blink | 49 } // namespace blink |
| 50 | 50 |
| 51 #endif // Interpolation_h | 51 #endif // Interpolation_h |
| OLD | NEW |