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 12 matching lines...) Expand all Loading... |
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
27 * OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "core/layout/shapes/PolygonShape.h" | 30 #include "core/layout/shapes/PolygonShape.h" |
31 | 31 |
32 #include "platform/geometry/LayoutPoint.h" | 32 #include "platform/geometry/LayoutPoint.h" |
33 #include "wtf/MathExtras.h" | 33 #include "platform/wtf/MathExtras.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 static inline FloatSize InwardEdgeNormal(const FloatPolygonEdge& edge) { | 37 static inline FloatSize InwardEdgeNormal(const FloatPolygonEdge& edge) { |
38 FloatSize edge_delta = edge.Vertex2() - edge.Vertex1(); | 38 FloatSize edge_delta = edge.Vertex2() - edge.Vertex1(); |
39 if (!edge_delta.Width()) | 39 if (!edge_delta.Width()) |
40 return FloatSize((edge_delta.Height() > 0 ? -1 : 1), 0); | 40 return FloatSize((edge_delta.Height() > 0 ? -1 : 1), 0); |
41 if (!edge_delta.Height()) | 41 if (!edge_delta.Height()) |
42 return FloatSize(0, (edge_delta.Width() > 0 ? 1 : -1)); | 42 return FloatSize(0, (edge_delta.Width() > 0 ? 1 : -1)); |
43 float edge_length = edge_delta.DiagonalLength(); | 43 float edge_length = edge_delta.DiagonalLength(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void PolygonShape::BuildDisplayPaths(DisplayPaths& paths) const { | 170 void PolygonShape::BuildDisplayPaths(DisplayPaths& paths) const { |
171 if (!polygon_.NumberOfVertices()) | 171 if (!polygon_.NumberOfVertices()) |
172 return; | 172 return; |
173 paths.shape.MoveTo(polygon_.VertexAt(0)); | 173 paths.shape.MoveTo(polygon_.VertexAt(0)); |
174 for (size_t i = 1; i < polygon_.NumberOfVertices(); ++i) | 174 for (size_t i = 1; i < polygon_.NumberOfVertices(); ++i) |
175 paths.shape.AddLineTo(polygon_.VertexAt(i)); | 175 paths.shape.AddLineTo(polygon_.VertexAt(i)); |
176 paths.shape.CloseSubpath(); | 176 paths.shape.CloseSubpath(); |
177 } | 177 } |
178 | 178 |
179 } // namespace blink | 179 } // namespace blink |
OLD | NEW |