Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: Source/core/animation/PrimitiveInterpolation.h

Issue 1302463002: Make classes and structures in Source/core/animation fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/animation/PointSVGInterpolation.h ('k') | Source/core/animation/PropertyHandle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 PrimitiveInterpolation_h 5 #ifndef PrimitiveInterpolation_h
6 #define PrimitiveInterpolation_h 6 #define PrimitiveInterpolation_h
7 7
8 #include "core/animation/InterpolationValue.h" 8 #include "core/animation/InterpolationValue.h"
9 #include "platform/animation/AnimationUtilities.h" 9 #include "platform/animation/AnimationUtilities.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "wtf/Vector.h" 11 #include "wtf/Vector.h"
12 #include <cmath> 12 #include <cmath>
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class StyleResolverState; 16 class StyleResolverState;
17 17
18 // Represents a conversion from a pair of keyframes to something compatible with interpolation. 18 // Represents a conversion from a pair of keyframes to something compatible with interpolation.
19 // This is agnostic to whether the keyframes are compatible with each other or n ot. 19 // This is agnostic to whether the keyframes are compatible with each other or n ot.
20 class PrimitiveInterpolation : public NoBaseWillBeGarbageCollectedFinalized<Prim itiveInterpolation> { 20 class PrimitiveInterpolation : public NoBaseWillBeGarbageCollectedFinalized<Prim itiveInterpolation> {
21 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PrimitiveInterpolation);
22 WTF_MAKE_NONCOPYABLE(PrimitiveInterpolation);
21 public: 23 public:
22 virtual ~PrimitiveInterpolation() { } 24 virtual ~PrimitiveInterpolation() { }
23 25
24 virtual void interpolateValue(double fraction, OwnPtrWillBeMember<Interpolat ionValue>& result) const = 0; 26 virtual void interpolateValue(double fraction, OwnPtrWillBeMember<Interpolat ionValue>& result) const = 0;
25 virtual double interpolateUnderlyingFraction(double start, double end, doubl e fraction) const = 0; 27 virtual double interpolateUnderlyingFraction(double start, double end, doubl e fraction) const = 0;
26 virtual bool isFlip() const { return false; } 28 virtual bool isFlip() const { return false; }
27 29
28 DEFINE_INLINE_VIRTUAL_TRACE() { } 30 DEFINE_INLINE_VIRTUAL_TRACE() { }
31
32 protected:
33 PrimitiveInterpolation() { }
29 }; 34 };
30 35
31 // Represents a pair of keyframes that are compatible for "smooth" interpolation eg. "0px" and "100px". 36 // Represents a pair of keyframes that are compatible for "smooth" interpolation eg. "0px" and "100px".
32 class PairwisePrimitiveInterpolation : public PrimitiveInterpolation { 37 class PairwisePrimitiveInterpolation : public PrimitiveInterpolation {
33 public: 38 public:
34 ~PairwisePrimitiveInterpolation() override { } 39 ~PairwisePrimitiveInterpolation() override { }
35 40
36 static PassOwnPtrWillBeRawPtr<PairwisePrimitiveInterpolation> create(const I nterpolationType& type, PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwn PtrWillBeRawPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<NonInterpolableVa lue> nonInterpolableValue) 41 static PassOwnPtrWillBeRawPtr<PairwisePrimitiveInterpolation> create(const I nterpolationType& type, PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwn PtrWillBeRawPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<NonInterpolableVa lue> nonInterpolableValue)
37 { 42 {
38 return adoptPtrWillBeNoop(new PairwisePrimitiveInterpolation(type, start , end, nonInterpolableValue)); 43 return adoptPtrWillBeNoop(new PairwisePrimitiveInterpolation(type, start , end, nonInterpolableValue));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool isFlip() const final { return true; } 119 bool isFlip() const final { return true; }
115 120
116 OwnPtrWillBeMember<InterpolationValue> m_start; 121 OwnPtrWillBeMember<InterpolationValue> m_start;
117 OwnPtrWillBeMember<InterpolationValue> m_end; 122 OwnPtrWillBeMember<InterpolationValue> m_end;
118 mutable double m_lastFraction; 123 mutable double m_lastFraction;
119 }; 124 };
120 125
121 } // namespace blink 126 } // namespace blink
122 127
123 #endif // PrimitiveInterpolation_h 128 #endif // PrimitiveInterpolation_h
OLDNEW
« no previous file with comments | « Source/core/animation/PointSVGInterpolation.h ('k') | Source/core/animation/PropertyHandle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698