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

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: More expectation updates. Created 5 years, 2 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
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 float arcAngle() const { return point2.x(); }
75
76 float r1() const { return arcRadii().x(); }
77 float r2() const { return arcRadii().y(); }
78
79 bool largeArcFlag() const { return arcLarge; }
80 bool sweepFlag() const { return arcSweep; }
81
82 float x() const { return targetPoint.x(); }
83 float y() const { return targetPoint.y(); }
84
85 float x1() const { return point1.x(); }
86 float y1() const { return point1.y(); }
87
88 float x2() const { return point2.x(); }
89 float y2() const { return point2.y(); }
90
91 SVGPathSegType command;
pdr. 2015/10/23 04:40:55 Could we get better packing by moving this next to
fs 2015/10/23 09:12:33 Just moving it will not gain us anything (FloatPoi
92 FloatPoint targetPoint;
93 FloatPoint point1;
94 FloatPoint point2;
95 bool arcSweep;
96 bool arcLarge;
97 };
98
99 } // namespace blink
100
101 #endif // SVGPathData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698