OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #ifndef SVGPathSeg_h | 21 #ifndef SVGPathSeg_h |
22 #define SVGPathSeg_h | 22 #define SVGPathSeg_h |
23 | 23 |
24 #include "bindings/core/v8/ScriptWrappable.h" | 24 #include "bindings/core/v8/ScriptWrappable.h" |
| 25 #include "platform/geometry/FloatPoint.h" |
25 #include "platform/heap/Handle.h" | 26 #include "platform/heap/Handle.h" |
26 #include "wtf/RefCounted.h" | 27 #include "wtf/RefCounted.h" |
27 #include "wtf/text/WTFString.h" | 28 #include "wtf/text/WTFString.h" |
28 | 29 |
29 namespace blink { | 30 namespace blink { |
30 | 31 |
31 enum ListModification { | 32 enum ListModification { |
32 ListModificationUnknown = 0, | 33 ListModificationUnknown = 0, |
33 ListModificationInsert = 1, | 34 ListModificationInsert = 1, |
34 ListModificationReplace = 2, | 35 ListModificationReplace = 2, |
(...skipping 17 matching lines...) Expand all Loading... |
52 PathSegLineToHorizontalAbs = 12, | 53 PathSegLineToHorizontalAbs = 12, |
53 PathSegLineToHorizontalRel = 13, | 54 PathSegLineToHorizontalRel = 13, |
54 PathSegLineToVerticalAbs = 14, | 55 PathSegLineToVerticalAbs = 14, |
55 PathSegLineToVerticalRel = 15, | 56 PathSegLineToVerticalRel = 15, |
56 PathSegCurveToCubicSmoothAbs = 16, | 57 PathSegCurveToCubicSmoothAbs = 16, |
57 PathSegCurveToCubicSmoothRel = 17, | 58 PathSegCurveToCubicSmoothRel = 17, |
58 PathSegCurveToQuadraticSmoothAbs = 18, | 59 PathSegCurveToQuadraticSmoothAbs = 18, |
59 PathSegCurveToQuadraticSmoothRel = 19 | 60 PathSegCurveToQuadraticSmoothRel = 19 |
60 }; | 61 }; |
61 | 62 |
| 63 static inline SVGPathSegType toAbsolutePathSegType(const SVGPathSegType type) |
| 64 { |
| 65 // Clear the LSB to get the absolute command. |
| 66 return type >= PathSegMoveToAbs ? static_cast<SVGPathSegType>(type & ~1u) :
type; |
| 67 } |
| 68 |
| 69 static inline bool isAbsolutePathSegType(const SVGPathSegType type) |
| 70 { |
| 71 // For commands with an ordinal >= PathSegMoveToAbs, and odd number => relat
ive command. |
| 72 return type < PathSegMoveToAbs || type % 2 == 0; |
| 73 } |
| 74 |
| 75 struct PathSegmentData { |
| 76 PathSegmentData() |
| 77 : command(PathSegUnknown) |
| 78 , arcSweep(false) |
| 79 , arcLarge(false) |
| 80 { |
| 81 } |
| 82 |
| 83 const FloatPoint& arcRadii() const { return point1; } |
| 84 float arcAngle() const { return point2.x(); } |
| 85 |
| 86 SVGPathSegType command; |
| 87 FloatPoint targetPoint; |
| 88 FloatPoint point1; |
| 89 FloatPoint point2; |
| 90 bool arcSweep; |
| 91 bool arcLarge; |
| 92 }; |
| 93 |
62 class SVGPropertyBase; | 94 class SVGPropertyBase; |
63 class SVGPathElement; | 95 class SVGPathElement; |
64 class SVGElement; | 96 class SVGElement; |
65 | 97 |
66 class SVGPathSeg : public RefCountedWillBeGarbageCollectedFinalized<SVGPathSeg>,
public ScriptWrappable { | 98 class SVGPathSeg : public RefCountedWillBeGarbageCollectedFinalized<SVGPathSeg>,
public ScriptWrappable { |
67 DEFINE_WRAPPERTYPEINFO(); | 99 DEFINE_WRAPPERTYPEINFO(); |
68 public: | 100 public: |
69 // SVGPathSeg itself is used as a tear-off type. | 101 // SVGPathSeg itself is used as a tear-off type. |
70 // FIXME: A tear-off type should be introduced to distinguish animVal/baseVa
l | 102 // FIXME: A tear-off type should be introduced to distinguish animVal/baseVa
l |
71 typedef SVGPathSeg TearOffType; | 103 typedef SVGPathSeg TearOffType; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 189 } |
158 | 190 |
159 private: | 191 private: |
160 float m_x; | 192 float m_x; |
161 float m_y; | 193 float m_y; |
162 }; | 194 }; |
163 | 195 |
164 } // namespace blink | 196 } // namespace blink |
165 | 197 |
166 #endif // SVGPathSeg_h | 198 #endif // SVGPathSeg_h |
OLD | NEW |