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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathData.h

Issue 1416273002: Remove SVGPathElement.pathSegList and related interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 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
(Empty)
1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef SVGPathData_h
22 #define SVGPathData_h
23
24 #include "platform/geometry/FloatPoint.h"
25 #include "wtf/Allocator.h"
26
27 namespace blink {
28
29 enum SVGPathSegType {
30 PathSegUnknown = 0,
31 PathSegClosePath = 1,
32 PathSegMoveToAbs = 2,
33 PathSegMoveToRel = 3,
34 PathSegLineToAbs = 4,
35 PathSegLineToRel = 5,
36 PathSegCurveToCubicAbs = 6,
37 PathSegCurveToCubicRel = 7,
38 PathSegCurveToQuadraticAbs = 8,
39 PathSegCurveToQuadraticRel = 9,
40 PathSegArcAbs = 10,
41 PathSegArcRel = 11,
42 PathSegLineToHorizontalAbs = 12,
43 PathSegLineToHorizontalRel = 13,
44 PathSegLineToVerticalAbs = 14,
45 PathSegLineToVerticalRel = 15,
46 PathSegCurveToCubicSmoothAbs = 16,
47 PathSegCurveToCubicSmoothRel = 17,
48 PathSegCurveToQuadraticSmoothAbs = 18,
49 PathSegCurveToQuadraticSmoothRel = 19
50 };
51
52 static inline SVGPathSegType toAbsolutePathSegType(const SVGPathSegType type)
53 {
54 // Clear the LSB to get the absolute command.
55 return type >= PathSegMoveToAbs ? static_cast<SVGPathSegType>(type & ~1u) : type;
56 }
57
58 static inline bool isAbsolutePathSegType(const SVGPathSegType type)
59 {
60 // For commands with an ordinal >= PathSegMoveToAbs, and odd number => relat ive command.
61 return type < PathSegMoveToAbs || type % 2 == 0;
62 }
63
64 struct PathSegmentData {
65 STACK_ALLOCATED();
66 PathSegmentData()
67 : command(PathSegUnknown)
68 , arcSweep(false)
69 , arcLarge(false)
70 {
71 }
72
73 const FloatPoint& arcRadii() const { return point1; }
74 FloatPoint& arcRadii() { return point1; }
75
76 float arcAngle() const { return point2.x(); }
77 void setArcAngle(float angle) { point2.setX(angle); }
78
79 float r1() const { return arcRadii().x(); }
80 float r2() const { return arcRadii().y(); }
81
82 bool largeArcFlag() const { return arcLarge; }
83 bool sweepFlag() const { return arcSweep; }
84
85 float x() const { return targetPoint.x(); }
86 float y() const { return targetPoint.y(); }
87
88 float x1() const { return point1.x(); }
89 float y1() const { return point1.y(); }
90
91 float x2() const { return point2.x(); }
92 float y2() const { return point2.y(); }
93
94 SVGPathSegType command;
95 FloatPoint targetPoint;
96 FloatPoint point1;
97 FloatPoint point2;
98 bool arcSweep;
99 bool arcLarge;
100 };
101
102 } // namespace blink
103
104 #endif // SVGPathData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.cpp ('k') | third_party/WebKit/Source/core/svg/SVGPathElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698