OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } | 157 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } |
158 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } | 158 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } |
159 const BasicShapeRadius& radius() const { return m_radius; } | 159 const BasicShapeRadius& radius() const { return m_radius; } |
160 | 160 |
161 float floatValueForRadiusInBox(FloatSize) const; | 161 float floatValueForRadiusInBox(FloatSize) const; |
162 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } | 162 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } |
163 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } | 163 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } |
164 void setRadius(BasicShapeRadius radius) { m_radius = radius; } | 164 void setRadius(BasicShapeRadius radius) { m_radius = radius; } |
165 | 165 |
166 virtual void path(Path&, const FloatRect&) override; | 166 void path(Path&, const FloatRect&) override; |
167 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; | 167 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; |
168 virtual bool operator==(const BasicShape&) const override; | 168 bool operator==(const BasicShape&) const override; |
169 | 169 |
170 virtual Type type() const override { return BasicShapeCircleType; } | 170 Type type() const override { return BasicShapeCircleType; } |
171 private: | 171 private: |
172 BasicShapeCircle() { } | 172 BasicShapeCircle() { } |
173 | 173 |
174 BasicShapeCenterCoordinate m_centerX; | 174 BasicShapeCenterCoordinate m_centerX; |
175 BasicShapeCenterCoordinate m_centerY; | 175 BasicShapeCenterCoordinate m_centerY; |
176 BasicShapeRadius m_radius; | 176 BasicShapeRadius m_radius; |
177 }; | 177 }; |
178 | 178 |
179 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle); | 179 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle); |
180 | 180 |
181 class BasicShapeEllipse final : public BasicShape { | 181 class BasicShapeEllipse final : public BasicShape { |
182 public: | 182 public: |
183 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha
peEllipse); } | 183 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha
peEllipse); } |
184 | 184 |
185 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } | 185 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } |
186 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } | 186 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } |
187 const BasicShapeRadius& radiusX() const { return m_radiusX; } | 187 const BasicShapeRadius& radiusX() const { return m_radiusX; } |
188 const BasicShapeRadius& radiusY() const { return m_radiusY; } | 188 const BasicShapeRadius& radiusY() const { return m_radiusY; } |
189 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float
boxWidthOrHeight) const; | 189 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float
boxWidthOrHeight) const; |
190 | 190 |
191 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } | 191 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } |
192 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } | 192 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } |
193 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; } | 193 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; } |
194 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; } | 194 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; } |
195 | 195 |
196 virtual void path(Path&, const FloatRect&) override; | 196 void path(Path&, const FloatRect&) override; |
197 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; | 197 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; |
198 virtual bool operator==(const BasicShape&) const override; | 198 bool operator==(const BasicShape&) const override; |
199 | 199 |
200 virtual Type type() const override { return BasicShapeEllipseType; } | 200 Type type() const override { return BasicShapeEllipseType; } |
201 private: | 201 private: |
202 BasicShapeEllipse() { } | 202 BasicShapeEllipse() { } |
203 | 203 |
204 BasicShapeCenterCoordinate m_centerX; | 204 BasicShapeCenterCoordinate m_centerX; |
205 BasicShapeCenterCoordinate m_centerY; | 205 BasicShapeCenterCoordinate m_centerY; |
206 BasicShapeRadius m_radiusX; | 206 BasicShapeRadius m_radiusX; |
207 BasicShapeRadius m_radiusY; | 207 BasicShapeRadius m_radiusY; |
208 }; | 208 }; |
209 | 209 |
210 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); | 210 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); |
211 | 211 |
212 class BasicShapePolygon final : public BasicShape { | 212 class BasicShapePolygon final : public BasicShape { |
213 public: | 213 public: |
214 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha
pePolygon); } | 214 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha
pePolygon); } |
215 | 215 |
216 const Vector<Length>& values() const { return m_values; } | 216 const Vector<Length>& values() const { return m_values; } |
217 Length getXAt(unsigned i) const { return m_values.at(2 * i); } | 217 Length getXAt(unsigned i) const { return m_values.at(2 * i); } |
218 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } | 218 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } |
219 | 219 |
220 void setWindRule(WindRule windRule) { m_windRule = windRule; } | 220 void setWindRule(WindRule windRule) { m_windRule = windRule; } |
221 void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_v
alues.append(y); } | 221 void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_v
alues.append(y); } |
222 | 222 |
223 virtual void path(Path&, const FloatRect&) override; | 223 void path(Path&, const FloatRect&) override; |
224 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; | 224 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; |
225 virtual bool operator==(const BasicShape&) const override; | 225 bool operator==(const BasicShape&) const override; |
226 | 226 |
227 virtual WindRule windRule() const override { return m_windRule; } | 227 WindRule windRule() const override { return m_windRule; } |
228 | 228 |
229 virtual Type type() const override { return BasicShapePolygonType; } | 229 Type type() const override { return BasicShapePolygonType; } |
230 private: | 230 private: |
231 BasicShapePolygon() | 231 BasicShapePolygon() |
232 : m_windRule(RULE_NONZERO) | 232 : m_windRule(RULE_NONZERO) |
233 { } | 233 { } |
234 | 234 |
235 WindRule m_windRule; | 235 WindRule m_windRule; |
236 Vector<Length> m_values; | 236 Vector<Length> m_values; |
237 }; | 237 }; |
238 | 238 |
239 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon); | 239 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon); |
(...skipping 15 matching lines...) Expand all Loading... |
255 void setTop(const Length& top) { m_top = top; } | 255 void setTop(const Length& top) { m_top = top; } |
256 void setRight(const Length& right) { m_right = right; } | 256 void setRight(const Length& right) { m_right = right; } |
257 void setBottom(const Length& bottom) { m_bottom = bottom; } | 257 void setBottom(const Length& bottom) { m_bottom = bottom; } |
258 void setLeft(const Length& left) { m_left = left; } | 258 void setLeft(const Length& left) { m_left = left; } |
259 | 259 |
260 void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius;
} | 260 void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius;
} |
261 void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius
; } | 261 void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius
; } |
262 void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius =
radius; } | 262 void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius =
radius; } |
263 void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = ra
dius; } | 263 void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = ra
dius; } |
264 | 264 |
265 virtual void path(Path&, const FloatRect&) override; | 265 void path(Path&, const FloatRect&) override; |
266 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; | 266 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; |
267 virtual bool operator==(const BasicShape&) const override; | 267 bool operator==(const BasicShape&) const override; |
268 | 268 |
269 virtual Type type() const override { return BasicShapeInsetType; } | 269 Type type() const override { return BasicShapeInsetType; } |
270 private: | 270 private: |
271 BasicShapeInset() { } | 271 BasicShapeInset() { } |
272 | 272 |
273 Length m_right; | 273 Length m_right; |
274 Length m_top; | 274 Length m_top; |
275 Length m_bottom; | 275 Length m_bottom; |
276 Length m_left; | 276 Length m_left; |
277 | 277 |
278 LengthSize m_topLeftRadius; | 278 LengthSize m_topLeftRadius; |
279 LengthSize m_topRightRadius; | 279 LengthSize m_topRightRadius; |
280 LengthSize m_bottomRightRadius; | 280 LengthSize m_bottomRightRadius; |
281 LengthSize m_bottomLeftRadius; | 281 LengthSize m_bottomLeftRadius; |
282 }; | 282 }; |
283 | 283 |
284 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); | 284 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); |
285 | 285 |
286 } | 286 } |
287 #endif | 287 #endif |
OLD | NEW |