OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. |
3 * 2006 Rob Buis <buis@kde.org> | 3 * 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 Path& operator=(const Path&); | 75 Path& operator=(const Path&); |
76 bool operator==(const Path&) const; | 76 bool operator==(const Path&) const; |
77 | 77 |
78 bool contains(const FloatPoint&, WindRule = RULE_NONZERO) const; | 78 bool contains(const FloatPoint&, WindRule = RULE_NONZERO) const; |
79 bool strokeContains(const FloatPoint&, const StrokeData&) const; | 79 bool strokeContains(const FloatPoint&, const StrokeData&) const; |
80 FloatRect boundingRect() const; | 80 FloatRect boundingRect() const; |
81 FloatRect strokeBoundingRect(const StrokeData&) const; | 81 FloatRect strokeBoundingRect(const StrokeData&) const; |
82 | 82 |
83 float length() const; | 83 float length() const; |
84 FloatPoint pointAtLength(float length, bool& ok) const; | 84 FloatPoint pointAtLength(float length, bool& ok) const; |
85 float normalAngleAtLength(float length, bool& ok) const; | |
86 bool pointAndNormalAtLength(float length, FloatPoint&, float&) const; | 85 bool pointAndNormalAtLength(float length, FloatPoint&, float&) const; |
87 | 86 |
88 // Helper for computing a sequence of positions and normals (normal angles)
on a path. | 87 // Helper for computing a sequence of positions and normals (normal angles)
on a path. |
89 // The best possible access pattern will be one where the |length| value is | 88 // The best possible access pattern will be one where the |length| value is |
90 // strictly increasing. | 89 // strictly increasing. |
91 // For other access patterns, performance will vary depending on curvature | 90 // For other access patterns, performance will vary depending on curvature |
92 // and number of segments, but should never be worse than that of the | 91 // and number of segments, but should never be worse than that of the |
93 // state-less method on Path. | 92 // state-less method on Path. |
94 class PLATFORM_EXPORT PositionCalculator { | 93 class PLATFORM_EXPORT PositionCalculator { |
95 WTF_MAKE_NONCOPYABLE(PositionCalculator); | 94 WTF_MAKE_NONCOPYABLE(PositionCalculator); |
(...skipping 12 matching lines...) Expand all Loading... |
108 bool isEmpty() const; | 107 bool isEmpty() const; |
109 // Specify whether this path is volatile. Temporary paths that are discarded
or | 108 // Specify whether this path is volatile. Temporary paths that are discarded
or |
110 // modified after use should be marked as volatile. This is a hint to the de
vice | 109 // modified after use should be marked as volatile. This is a hint to the de
vice |
111 // to not cache this path. | 110 // to not cache this path. |
112 void setIsVolatile(bool); | 111 void setIsVolatile(bool); |
113 // Gets the current point of the current path, which is conceptually the fin
al point reached by the path so far. | 112 // Gets the current point of the current path, which is conceptually the fin
al point reached by the path so far. |
114 // Note the Path can be empty (isEmpty() == true) and still have a current p
oint. | 113 // Note the Path can be empty (isEmpty() == true) and still have a current p
oint. |
115 bool hasCurrentPoint() const; | 114 bool hasCurrentPoint() const; |
116 FloatPoint currentPoint() const; | 115 FloatPoint currentPoint() const; |
117 | 116 |
118 WindRule windRule() const; | |
119 void setWindRule(const WindRule); | 117 void setWindRule(const WindRule); |
120 | 118 |
121 void moveTo(const FloatPoint&); | 119 void moveTo(const FloatPoint&); |
122 void addLineTo(const FloatPoint&); | 120 void addLineTo(const FloatPoint&); |
123 void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& endPoi
nt); | 121 void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& endPoi
nt); |
124 void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& con
trolPoint2, const FloatPoint& endPoint); | 122 void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& con
trolPoint2, const FloatPoint& endPoint); |
125 void addArcTo(const FloatPoint&, const FloatPoint&, float radius); | 123 void addArcTo(const FloatPoint&, const FloatPoint&, float radius); |
126 void closeSubpath(); | 124 void closeSubpath(); |
127 | 125 |
128 void addArc(const FloatPoint&, float radius, float startAngle, float endAngl
e, bool anticlockwise); | 126 void addArc(const FloatPoint&, float radius, float startAngle, float endAngl
e, bool anticlockwise); |
(...skipping 11 matching lines...) Expand all Loading... |
140 | 138 |
141 const SkPath& skPath() const { return m_path; } | 139 const SkPath& skPath() const { return m_path; } |
142 | 140 |
143 void apply(void* info, PathApplierFunction) const; | 141 void apply(void* info, PathApplierFunction) const; |
144 void transform(const AffineTransform&); | 142 void transform(const AffineTransform&); |
145 | 143 |
146 void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius,
const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Float
Size& bottomRightRadius); | 144 void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius,
const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Float
Size& bottomRightRadius); |
147 void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadi
us, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Fl
oatSize& bottomRightRadius); | 145 void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadi
us, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Fl
oatSize& bottomRightRadius); |
148 | 146 |
149 bool subtractPath(const Path&); | 147 bool subtractPath(const Path&); |
150 bool intersectPath(const Path&); | |
151 | 148 |
152 // Updates the path to the union (inclusive-or) of itself with the given arg
ument. | 149 // Updates the path to the union (inclusive-or) of itself with the given arg
ument. |
153 bool unionPath(const Path& other); | 150 bool unionPath(const Path& other); |
154 | 151 |
155 private: | 152 private: |
156 void addEllipse(const FloatPoint&, float radiusX, float radiusY, float start
Angle, float endAngle, bool anticlockwise); | 153 void addEllipse(const FloatPoint&, float radiusX, float radiusY, float start
Angle, float endAngle, bool anticlockwise); |
157 | 154 |
158 SkPath m_path; | 155 SkPath m_path; |
159 }; | 156 }; |
160 | 157 |
161 #if ENABLE(ASSERT) | 158 #if ENABLE(ASSERT) |
162 PLATFORM_EXPORT bool ellipseIsRenderable(float startAngle, float endAngle); | 159 PLATFORM_EXPORT bool ellipseIsRenderable(float startAngle, float endAngle); |
163 #endif | 160 #endif |
164 | 161 |
165 } // namespace blink | 162 } // namespace blink |
166 | 163 |
167 #endif | 164 #endif |
OLD | NEW |