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

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolatedSVGPathSource.h

Issue 1646543004: Refactor away SVGPathSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use namespace Created 4 years, 10 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 | « no previous file | third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp » ('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 InterpolatedSVGPathSource_h 5 #ifndef InterpolatedSVGPathSource_h
6 #define InterpolatedSVGPathSource_h 6 #define InterpolatedSVGPathSource_h
7 7
8 #include "core/animation/SVGPathSegInterpolationFunctions.h" 8 #include "core/animation/SVGPathSegInterpolationFunctions.h"
9 #include "core/svg/SVGPathSource.h" 9 #include "core/svg/SVGPathData.h"
10 #include "wtf/Vector.h" 10 #include "wtf/Vector.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class InterpolatedSVGPathSource : public SVGPathSource { 14 class InterpolatedSVGPathSource {
15 WTF_MAKE_NONCOPYABLE(InterpolatedSVGPathSource);
16 STACK_ALLOCATED();
15 public: 17 public:
16 InterpolatedSVGPathSource(const InterpolableList& listValue, const Vector<SV GPathSegType>& pathSegTypes) 18 InterpolatedSVGPathSource(const InterpolableList& listValue, const Vector<SV GPathSegType>& pathSegTypes)
17 : m_currentIndex(0) 19 : m_currentIndex(0)
18 , m_interpolablePathSegs(listValue) 20 , m_interpolablePathSegs(listValue)
19 , m_pathSegTypes(pathSegTypes) 21 , m_pathSegTypes(pathSegTypes)
20 { 22 {
21 ASSERT(m_interpolablePathSegs.length() == m_pathSegTypes.size()); 23 ASSERT(m_interpolablePathSegs.length() == m_pathSegTypes.size());
22 } 24 }
23 25
26 bool hasMoreData() const;
27 PathSegmentData parseSegment();
28
24 private: 29 private:
25 bool hasMoreData() const override;
26 SVGPathSegType peekSegmentType() override;
27 PathSegmentData parseSegment() override;
28
29 PathCoordinates m_currentCoordinates; 30 PathCoordinates m_currentCoordinates;
30 size_t m_currentIndex; 31 size_t m_currentIndex;
31 const InterpolableList& m_interpolablePathSegs; 32 const InterpolableList& m_interpolablePathSegs;
32 const Vector<SVGPathSegType>& m_pathSegTypes; 33 const Vector<SVGPathSegType>& m_pathSegTypes;
33 }; 34 };
34 35
35 bool InterpolatedSVGPathSource::hasMoreData() const 36 bool InterpolatedSVGPathSource::hasMoreData() const
36 { 37 {
37 return m_currentIndex < m_interpolablePathSegs.length(); 38 return m_currentIndex < m_interpolablePathSegs.length();
38 } 39 }
39 40
40 SVGPathSegType InterpolatedSVGPathSource::peekSegmentType()
41 {
42 ASSERT(hasMoreData());
43 return m_pathSegTypes.at(m_currentIndex);
44 }
45
46 PathSegmentData InterpolatedSVGPathSource::parseSegment() 41 PathSegmentData InterpolatedSVGPathSource::parseSegment()
47 { 42 {
48 PathSegmentData segment = SVGPathSegInterpolationFunctions::consumeInterpola blePathSeg(*m_interpolablePathSegs.get(m_currentIndex), m_pathSegTypes.at(m_curr entIndex), m_currentCoordinates); 43 PathSegmentData segment = SVGPathSegInterpolationFunctions::consumeInterpola blePathSeg(*m_interpolablePathSegs.get(m_currentIndex), m_pathSegTypes.at(m_curr entIndex), m_currentCoordinates);
49 m_currentIndex++; 44 m_currentIndex++;
50 return segment; 45 return segment;
51 } 46 }
52 47
53 } // namespace blink 48 } // namespace blink
54 49
55 #endif // InterpolatedSVGPathSource_h 50 #endif // InterpolatedSVGPathSource_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/PathInterpolationFunctions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698