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

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolableValue.cpp

Issue 2487913002: Remove InterpolableBool and existing use of it in SVG path interpolation (Closed)
Patch Set: Created 4 years, 1 month 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
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 "core/animation/InterpolableValue.h" 5 #include "core/animation/InterpolableValue.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 if (progress == 0 || m_value == toNumber.m_value) 32 if (progress == 0 || m_value == toNumber.m_value)
33 resultNumber.m_value = m_value; 33 resultNumber.m_value = m_value;
34 else if (progress == 1) 34 else if (progress == 1)
35 resultNumber.m_value = toNumber.m_value; 35 resultNumber.m_value = toNumber.m_value;
36 else 36 else
37 resultNumber.m_value = 37 resultNumber.m_value =
38 m_value * (1 - progress) + toNumber.m_value * progress; 38 m_value * (1 - progress) + toNumber.m_value * progress;
39 } 39 }
40 40
41 void InterpolableBool::interpolate(const InterpolableValue& to,
42 const double progress,
43 InterpolableValue& result) const {
44 const InterpolableBool& toBool = toInterpolableBool(to);
45 InterpolableBool& resultBool = toInterpolableBool(result);
46
47 if (progress < 0.5)
48 resultBool.m_value = m_value;
49 else
50 resultBool.m_value = toBool.m_value;
51 }
52
53 void InterpolableList::interpolate(const InterpolableValue& to, 41 void InterpolableList::interpolate(const InterpolableValue& to,
54 const double progress, 42 const double progress,
55 InterpolableValue& result) const { 43 InterpolableValue& result) const {
56 const InterpolableList& toList = toInterpolableList(to); 44 const InterpolableList& toList = toInterpolableList(to);
57 InterpolableList& resultList = toInterpolableList(result); 45 InterpolableList& resultList = toInterpolableList(result);
58 46
59 DCHECK_EQ(toList.length(), length()); 47 DCHECK_EQ(toList.length(), length());
60 DCHECK_EQ(resultList.length(), length()); 48 DCHECK_EQ(resultList.length(), length());
61 49
62 for (size_t i = 0; i < length(); i++) { 50 for (size_t i = 0; i < length(); i++) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 toInterpolableAnimatableValue(result); 93 toInterpolableAnimatableValue(result);
106 if (progress == 0) 94 if (progress == 0)
107 resultValue.m_value = m_value; 95 resultValue.m_value = m_value;
108 if (progress == 1) 96 if (progress == 1)
109 resultValue.m_value = toValue.m_value; 97 resultValue.m_value = toValue.m_value;
110 resultValue.m_value = AnimatableValue::interpolate( 98 resultValue.m_value = AnimatableValue::interpolate(
111 m_value.get(), toValue.m_value.get(), progress); 99 m_value.get(), toValue.m_value.get(), progress);
112 } 100 }
113 101
114 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698