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

Unified Diff: Source/core/animation/InterpolableValue.cpp

Issue 1215563002: Implement left property animation on InvalidatableStyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make Windows not crash Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/animation/InterpolableValue.h ('k') | Source/core/animation/InterpolableValueTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/InterpolableValue.cpp
diff --git a/Source/core/animation/InterpolableValue.cpp b/Source/core/animation/InterpolableValue.cpp
index 733cfd19f73979cec29a305e80e2783c8959dcfb..cd132abed93fe353b893ca20a458fb7be1902cb1 100644
--- a/Source/core/animation/InterpolableValue.cpp
+++ b/Source/core/animation/InterpolableValue.cpp
@@ -48,54 +48,17 @@ void InterpolableList::interpolate(const InterpolableValue& to, const double pro
}
}
-void InterpolableNumber::add(const InterpolableValue& rhs, InterpolableValue& result) const
+void InterpolableNumber::scaleAndAdd(double scale, const InterpolableValue& other)
{
- const InterpolableNumber& rhsNumber = toInterpolableNumber(rhs);
- InterpolableNumber& resultNumber = toInterpolableNumber(result);
-
- resultNumber.m_value = m_value + rhsNumber.m_value;
-}
-
-void InterpolableNumber::multiply(double scalar, InterpolableValue& result) const
-{
- InterpolableNumber& resultNumber = toInterpolableNumber(result);
-
- resultNumber.m_value = scalar * m_value;
+ m_value = m_value * scale + toInterpolableNumber(other).m_value;
}
-void InterpolableBool::add(const InterpolableValue& rhs, InterpolableValue& result) const
+void InterpolableList::scaleAndAdd(double scale, const InterpolableValue& other)
{
- const InterpolableBool& rhsBool = toInterpolableBool(rhs);
- InterpolableBool& resultBool = toInterpolableBool(result);
-
- resultBool.m_value = m_value || rhsBool.m_value;
-}
-
-void InterpolableList::add(const InterpolableValue& rhs, InterpolableValue& result) const
-{
- const InterpolableList& rhsList = toInterpolableList(rhs);
- InterpolableList& resultList = toInterpolableList(result);
-
- ASSERT(rhsList.m_size == m_size);
- ASSERT(resultList.m_size == m_size);
-
- for (size_t i = 0; i < m_size; i++) {
- ASSERT(m_values[i]);
- ASSERT(rhsList.m_values[i]);
- m_values[i]->add(*(rhsList.m_values[i]), *(resultList.m_values[i]));
- }
-}
-
-void InterpolableList::multiply(double scalar, InterpolableValue& result) const
-{
- InterpolableList& resultList = toInterpolableList(result);
-
- ASSERT(resultList.m_size == m_size);
-
- for (size_t i = 0; i < m_size; i++) {
- ASSERT(m_values[i]);
- m_values[i]->multiply(scalar, *(resultList.m_values[i]));
- }
+ const InterpolableList& otherList = toInterpolableList(other);
+ ASSERT(otherList.m_size == m_size);
+ for (size_t i = 0; i < m_size; i++)
+ m_values[i]->scaleAndAdd(scale, *otherList.m_values[i]);
}
DEFINE_TRACE(InterpolableList)
« no previous file with comments | « Source/core/animation/InterpolableValue.h ('k') | Source/core/animation/InterpolableValueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698