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

Unified Diff: third_party/WebKit/Source/core/animation/InterpolatedSVGPathSource.h

Issue 1441853002: Web Animations: Add SVGPathInterpolationType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_svgNumberListInterpolationType
Patch Set: Rebased Created 5 years 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
Index: third_party/WebKit/Source/core/animation/InterpolatedSVGPathSource.h
diff --git a/third_party/WebKit/Source/core/animation/InterpolatedSVGPathSource.h b/third_party/WebKit/Source/core/animation/InterpolatedSVGPathSource.h
new file mode 100644
index 0000000000000000000000000000000000000000..62523418ded7eca863c5f5998695a2bb3822bdf6
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/InterpolatedSVGPathSource.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef InterpolatedSVGPathSource_h
+#define InterpolatedSVGPathSource_h
+
+#include "core/animation/SVGPathSegInterpolationFunctions.h"
+#include "core/svg/SVGPathSource.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+class InterpolatedSVGPathSource : public SVGPathSource {
+public:
+ InterpolatedSVGPathSource(const InterpolableList& listValue, const Vector<SVGPathSegType>& pathSegTypes)
+ : m_currentIndex(0)
+ , m_interpolablePathSegs(listValue)
+ , m_pathSegTypes(pathSegTypes)
+ {
+ ASSERT(m_interpolablePathSegs.length() == m_pathSegTypes.size());
+ }
+
+private:
+ bool hasMoreData() const override;
+ SVGPathSegType peekSegmentType() override;
+ PathSegmentData parseSegment() override;
+
+ PathCoordinates m_currentCoordinates;
+ size_t m_currentIndex;
+ const InterpolableList& m_interpolablePathSegs;
+ const Vector<SVGPathSegType>& m_pathSegTypes;
+};
+
+bool InterpolatedSVGPathSource::hasMoreData() const
+{
+ return m_currentIndex < m_interpolablePathSegs.length();
+}
+
+SVGPathSegType InterpolatedSVGPathSource::peekSegmentType()
+{
+ ASSERT(hasMoreData());
+ return m_pathSegTypes.at(m_currentIndex);
+}
+
+PathSegmentData InterpolatedSVGPathSource::parseSegment()
+{
+ PathSegmentData segment = SVGPathSegInterpolationFunctions::consumeInterpolablePathSeg(*m_interpolablePathSegs.get(m_currentIndex), m_pathSegTypes.at(m_currentIndex), m_currentCoordinates);
+ m_currentIndex++;
+ return segment;
+}
+
+} // namespace blink
+
+#endif // InterpolatedSVGPathSource_h

Powered by Google App Engine
This is Rietveld 408576698