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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRang
eNonNegative)); | 143 return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRang
eNonNegative)); |
144 } | 144 } |
145 | 145 |
146 private: | 146 private: |
147 Length m_value; | 147 Length m_value; |
148 Type m_type; | 148 Type m_type; |
149 | 149 |
150 }; | 150 }; |
151 | 151 |
152 class BasicShapeCircle FINAL : public BasicShape { | 152 class BasicShapeCircle final : public BasicShape { |
153 public: | 153 public: |
154 static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShap
eCircle); } | 154 static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShap
eCircle); } |
155 | 155 |
156 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } | 156 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } |
157 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } | 157 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } |
158 const BasicShapeRadius& radius() const { return m_radius; } | 158 const BasicShapeRadius& radius() const { return m_radius; } |
159 | 159 |
160 float floatValueForRadiusInBox(FloatSize) const; | 160 float floatValueForRadiusInBox(FloatSize) const; |
161 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } | 161 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } |
162 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } | 162 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } |
163 void setRadius(BasicShapeRadius radius) { m_radius = radius; } | 163 void setRadius(BasicShapeRadius radius) { m_radius = radius; } |
164 | 164 |
165 virtual void path(Path&, const FloatRect&) OVERRIDE; | 165 virtual void path(Path&, const FloatRect&) override; |
166 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI
DE; | 166 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; |
167 virtual bool operator==(const BasicShape&) const OVERRIDE; | 167 virtual bool operator==(const BasicShape&) const override; |
168 | 168 |
169 virtual Type type() const OVERRIDE { return BasicShapeCircleType; } | 169 virtual Type type() const override { return BasicShapeCircleType; } |
170 private: | 170 private: |
171 BasicShapeCircle() { } | 171 BasicShapeCircle() { } |
172 | 172 |
173 BasicShapeCenterCoordinate m_centerX; | 173 BasicShapeCenterCoordinate m_centerX; |
174 BasicShapeCenterCoordinate m_centerY; | 174 BasicShapeCenterCoordinate m_centerY; |
175 BasicShapeRadius m_radius; | 175 BasicShapeRadius m_radius; |
176 }; | 176 }; |
177 | 177 |
178 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle); | 178 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle); |
179 | 179 |
180 class BasicShapeEllipse FINAL : public BasicShape { | 180 class BasicShapeEllipse final : public BasicShape { |
181 public: | 181 public: |
182 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha
peEllipse); } | 182 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha
peEllipse); } |
183 | 183 |
184 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } | 184 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } |
185 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } | 185 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } |
186 const BasicShapeRadius& radiusX() const { return m_radiusX; } | 186 const BasicShapeRadius& radiusX() const { return m_radiusX; } |
187 const BasicShapeRadius& radiusY() const { return m_radiusY; } | 187 const BasicShapeRadius& radiusY() const { return m_radiusY; } |
188 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float
boxWidthOrHeight) const; | 188 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float
boxWidthOrHeight) const; |
189 | 189 |
190 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } | 190 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } |
191 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } | 191 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } |
192 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; } | 192 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; } |
193 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; } | 193 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; } |
194 | 194 |
195 virtual void path(Path&, const FloatRect&) OVERRIDE; | 195 virtual void path(Path&, const FloatRect&) override; |
196 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI
DE; | 196 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; |
197 virtual bool operator==(const BasicShape&) const OVERRIDE; | 197 virtual bool operator==(const BasicShape&) const override; |
198 | 198 |
199 virtual Type type() const OVERRIDE { return BasicShapeEllipseType; } | 199 virtual Type type() const override { return BasicShapeEllipseType; } |
200 private: | 200 private: |
201 BasicShapeEllipse() { } | 201 BasicShapeEllipse() { } |
202 | 202 |
203 BasicShapeCenterCoordinate m_centerX; | 203 BasicShapeCenterCoordinate m_centerX; |
204 BasicShapeCenterCoordinate m_centerY; | 204 BasicShapeCenterCoordinate m_centerY; |
205 BasicShapeRadius m_radiusX; | 205 BasicShapeRadius m_radiusX; |
206 BasicShapeRadius m_radiusY; | 206 BasicShapeRadius m_radiusY; |
207 }; | 207 }; |
208 | 208 |
209 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); | 209 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); |
210 | 210 |
211 class BasicShapePolygon FINAL : public BasicShape { | 211 class BasicShapePolygon final : public BasicShape { |
212 public: | 212 public: |
213 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha
pePolygon); } | 213 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha
pePolygon); } |
214 | 214 |
215 const Vector<Length>& values() const { return m_values; } | 215 const Vector<Length>& values() const { return m_values; } |
216 Length getXAt(unsigned i) const { return m_values.at(2 * i); } | 216 Length getXAt(unsigned i) const { return m_values.at(2 * i); } |
217 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } | 217 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } |
218 | 218 |
219 void setWindRule(WindRule windRule) { m_windRule = windRule; } | 219 void setWindRule(WindRule windRule) { m_windRule = windRule; } |
220 void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_v
alues.append(y); } | 220 void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_v
alues.append(y); } |
221 | 221 |
222 virtual void path(Path&, const FloatRect&) OVERRIDE; | 222 virtual void path(Path&, const FloatRect&) override; |
223 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI
DE; | 223 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; |
224 virtual bool operator==(const BasicShape&) const OVERRIDE; | 224 virtual bool operator==(const BasicShape&) const override; |
225 | 225 |
226 virtual WindRule windRule() const OVERRIDE { return m_windRule; } | 226 virtual WindRule windRule() const override { return m_windRule; } |
227 | 227 |
228 virtual Type type() const OVERRIDE { return BasicShapePolygonType; } | 228 virtual Type type() const override { return BasicShapePolygonType; } |
229 private: | 229 private: |
230 BasicShapePolygon() | 230 BasicShapePolygon() |
231 : m_windRule(RULE_NONZERO) | 231 : m_windRule(RULE_NONZERO) |
232 { } | 232 { } |
233 | 233 |
234 WindRule m_windRule; | 234 WindRule m_windRule; |
235 Vector<Length> m_values; | 235 Vector<Length> m_values; |
236 }; | 236 }; |
237 | 237 |
238 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon); | 238 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon); |
(...skipping 15 matching lines...) Expand all Loading... |
254 void setTop(const Length& top) { m_top = top; } | 254 void setTop(const Length& top) { m_top = top; } |
255 void setRight(const Length& right) { m_right = right; } | 255 void setRight(const Length& right) { m_right = right; } |
256 void setBottom(const Length& bottom) { m_bottom = bottom; } | 256 void setBottom(const Length& bottom) { m_bottom = bottom; } |
257 void setLeft(const Length& left) { m_left = left; } | 257 void setLeft(const Length& left) { m_left = left; } |
258 | 258 |
259 void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius;
} | 259 void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius;
} |
260 void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius
; } | 260 void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius
; } |
261 void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius =
radius; } | 261 void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius =
radius; } |
262 void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = ra
dius; } | 262 void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = ra
dius; } |
263 | 263 |
264 virtual void path(Path&, const FloatRect&) OVERRIDE; | 264 virtual void path(Path&, const FloatRect&) override; |
265 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const OVERRI
DE; | 265 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const overri
de; |
266 virtual bool operator==(const BasicShape&) const OVERRIDE; | 266 virtual bool operator==(const BasicShape&) const override; |
267 | 267 |
268 virtual Type type() const OVERRIDE { return BasicShapeInsetType; } | 268 virtual Type type() const override { return BasicShapeInsetType; } |
269 private: | 269 private: |
270 BasicShapeInset() { } | 270 BasicShapeInset() { } |
271 | 271 |
272 Length m_right; | 272 Length m_right; |
273 Length m_top; | 273 Length m_top; |
274 Length m_bottom; | 274 Length m_bottom; |
275 Length m_left; | 275 Length m_left; |
276 | 276 |
277 LengthSize m_topLeftRadius; | 277 LengthSize m_topLeftRadius; |
278 LengthSize m_topRightRadius; | 278 LengthSize m_topRightRadius; |
279 LengthSize m_bottomRightRadius; | 279 LengthSize m_bottomRightRadius; |
280 LengthSize m_bottomLeftRadius; | 280 LengthSize m_bottomLeftRadius; |
281 }; | 281 }; |
282 | 282 |
283 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); | 283 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); |
284 | 284 |
285 } | 285 } |
286 #endif | 286 #endif |
OLD | NEW |