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

Side by Side Diff: Source/core/animation/InterpolationEffect.cpp

Issue 1276183004: Oilpan: Unship oilpan from temporary animation objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
OLDNEW
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/InterpolationEffect.h" 6 #include "core/animation/InterpolationEffect.h"
7 7
8 namespace blink { 8 namespace blink {
9 9
10 void InterpolationEffect::getActiveInterpolations(double fraction, double iterat ionDuration, OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolatio n>>>& result) const 10 void InterpolationEffect::getActiveInterpolations(double fraction, double iterat ionDuration, OwnPtr<Vector<RefPtr<Interpolation>>>& result) const
11 { 11 {
12 if (!result) 12 if (!result)
13 result = adoptPtrWillBeNoop(new WillBeHeapVector<RefPtrWillBeMember<Inte rpolation>>()); 13 result = adoptPtr(new Vector<RefPtr<Interpolation>>());
14 14
15 size_t existingSize = result->size(); 15 size_t existingSize = result->size();
16 size_t resultIndex = 0; 16 size_t resultIndex = 0;
17 17
18 for (const auto& record : m_interpolations) { 18 for (const auto& record : m_interpolations) {
19 if (fraction >= record->m_applyFrom && fraction < record->m_applyTo) { 19 if (fraction >= record->m_applyFrom && fraction < record->m_applyTo) {
20 RefPtrWillBeRawPtr<Interpolation> interpolation = record->m_interpol ation; 20 RefPtr<Interpolation> interpolation = record->m_interpolation;
21 double localFraction = (fraction - record->m_start) / (record->m_end - record->m_start); 21 double localFraction = (fraction - record->m_start) / (record->m_end - record->m_start);
22 if (record->m_easing) 22 if (record->m_easing)
23 localFraction = record->m_easing->evaluate(localFraction, accura cyForDuration(iterationDuration)); 23 localFraction = record->m_easing->evaluate(localFraction, accura cyForDuration(iterationDuration));
24 interpolation->interpolate(0, localFraction); 24 interpolation->interpolate(0, localFraction);
25 if (resultIndex < existingSize) 25 if (resultIndex < existingSize)
26 (*result)[resultIndex++] = interpolation; 26 (*result)[resultIndex++] = interpolation;
27 else 27 else
28 result->append(interpolation); 28 result->append(interpolation);
29 } 29 }
30 } 30 }
31 if (resultIndex < existingSize) 31 if (resultIndex < existingSize)
32 result->shrink(resultIndex); 32 result->shrink(resultIndex);
33 } 33 }
34 34
35 void InterpolationEffect::addInterpolationsFromKeyframes(PropertyHandle property , Element* element, const ComputedStyle* baseStyle, Keyframe::PropertySpecificKe yframe& keyframeA, Keyframe::PropertySpecificKeyframe& keyframeB, double applyFr om, double applyTo) 35 void InterpolationEffect::addInterpolationsFromKeyframes(PropertyHandle property , Element* element, const ComputedStyle* baseStyle, Keyframe::PropertySpecificKe yframe& keyframeA, Keyframe::PropertySpecificKeyframe& keyframeB, double applyFr om, double applyTo)
36 { 36 {
37 RefPtrWillBeRawPtr<Interpolation> interpolation = keyframeA.maybeCreateInter polation(property, keyframeB, element, baseStyle); 37 RefPtr<Interpolation> interpolation = keyframeA.maybeCreateInterpolation(pro perty, keyframeB, element, baseStyle);
38 38
39 if (interpolation) { 39 if (interpolation) {
40 addInterpolation(interpolation, &keyframeA.easing(), keyframeA.offset(), keyframeB.offset(), applyFrom, applyTo); 40 addInterpolation(interpolation, &keyframeA.easing(), keyframeA.offset(), keyframeB.offset(), applyFrom, applyTo);
41 } else { 41 } else {
42 RefPtrWillBeRawPtr<Interpolation> interpolationA = keyframeA.maybeCreate Interpolation(property, keyframeA, element, baseStyle); 42 RefPtr<Interpolation> interpolationA = keyframeA.maybeCreateInterpolatio n(property, keyframeA, element, baseStyle);
43 RefPtrWillBeRawPtr<Interpolation> interpolationB = keyframeB.maybeCreate Interpolation(property, keyframeB, element, baseStyle); 43 RefPtr<Interpolation> interpolationB = keyframeB.maybeCreateInterpolatio n(property, keyframeB, element, baseStyle);
44 44
45 Vector<TimingFunction::PartitionRegion> regions = Vector<TimingFunction: :PartitionRegion>(); 45 Vector<TimingFunction::PartitionRegion> regions = Vector<TimingFunction: :PartitionRegion>();
46 keyframeA.easing().partition(regions); 46 keyframeA.easing().partition(regions);
47 47
48 size_t regionIndex = 0; 48 size_t regionIndex = 0;
49 for (const auto& region : regions) { 49 for (const auto& region : regions) {
50 double regionStart = blend(keyframeA.offset(), keyframeB.offset(), r egion.start); 50 double regionStart = blend(keyframeA.offset(), keyframeB.offset(), r egion.start);
51 double regionEnd = blend(keyframeA.offset(), keyframeB.offset(), reg ion.end); 51 double regionEnd = blend(keyframeA.offset(), keyframeB.offset(), reg ion.end);
52 52
53 double regionApplyFrom = regionIndex == 0 ? applyFrom : regionStart; 53 double regionApplyFrom = regionIndex == 0 ? applyFrom : regionStart;
(...skipping 11 matching lines...) Expand all
65 if (interpolation) { 65 if (interpolation) {
66 addInterpolation(interpolation.release(), 66 addInterpolation(interpolation.release(),
67 &keyframeA.easing(), regionStart, regionEnd, regionApplyFrom , regionApplyTo); 67 &keyframeA.easing(), regionStart, regionEnd, regionApplyFrom , regionApplyTo);
68 } 68 }
69 69
70 regionIndex++; 70 regionIndex++;
71 } 71 }
72 } 72 }
73 } 73 }
74 74
75 DEFINE_TRACE(InterpolationEffect::InterpolationRecord)
76 {
77 visitor->trace(m_interpolation);
78 }
79
80 DEFINE_TRACE(InterpolationEffect)
81 {
82 visitor->trace(m_interpolations);
83 }
84
85 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698