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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 if (y == minY()) | 62 if (y == minY()) |
63 return vertex1().y() < vertex2().y() ? vertex1().x() : vertex2().x(); | 63 return vertex1().y() < vertex2().y() ? vertex1().x() : vertex2().x(); |
64 if (y == maxY()) | 64 if (y == maxY()) |
65 return vertex1().y() > vertex2().y() ? vertex1().x() : vertex2().x(); | 65 return vertex1().y() > vertex2().y() ? vertex1().x() : vertex2().x(); |
66 | 66 |
67 return vertex1().x() + ((y - vertex1().y()) * (vertex2().x() - vertex1().x()
) / (vertex2().y() - vertex1().y())); | 67 return vertex1().x() + ((y - vertex1().y()) * (vertex2().x() - vertex1().x()
) / (vertex2().y() - vertex1().y())); |
68 } | 68 } |
69 | 69 |
70 FloatShapeInterval OffsetPolygonEdge::clippedEdgeXRange(float y1, float y2) cons
t | 70 FloatShapeInterval OffsetPolygonEdge::clippedEdgeXRange(float y1, float y2) cons
t |
71 { | 71 { |
72 if (!overlapsYRange(y1, y2) || (y1 == maxY() && vertex2().y() < vertex1().y(
))) | 72 if (!overlapsYRange(y1, y2) || (y1 == maxY() && minY() <= y1) || (y2 == minY
() && maxY() >= y2)) |
73 return FloatShapeInterval(); | 73 return FloatShapeInterval(); |
74 | 74 |
75 if (isWithinYRange(y1, y2)) | 75 if (isWithinYRange(y1, y2)) |
76 return FloatShapeInterval(minX(), maxX()); | 76 return FloatShapeInterval(minX(), maxX()); |
77 | 77 |
78 // Clip the edge line segment to the vertical range y1,y2 and then return | 78 // Clip the edge line segment to the vertical range y1,y2 and then return |
79 // the clipped line segment's horizontal range. | 79 // the clipped line segment's horizontal range. |
80 | 80 |
81 FloatPoint minYVertex; | 81 FloatPoint minYVertex; |
82 FloatPoint maxYVertex; | 82 FloatPoint maxYVertex; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 { | 154 { |
155 if (!m_polygon.numberOfVertices()) | 155 if (!m_polygon.numberOfVertices()) |
156 return; | 156 return; |
157 paths.shape.moveTo(m_polygon.vertexAt(0)); | 157 paths.shape.moveTo(m_polygon.vertexAt(0)); |
158 for (size_t i = 1; i < m_polygon.numberOfVertices(); ++i) | 158 for (size_t i = 1; i < m_polygon.numberOfVertices(); ++i) |
159 paths.shape.addLineTo(m_polygon.vertexAt(i)); | 159 paths.shape.addLineTo(m_polygon.vertexAt(i)); |
160 paths.shape.closeSubpath(); | 160 paths.shape.closeSubpath(); |
161 } | 161 } |
162 | 162 |
163 } // namespace WebCore | 163 } // namespace WebCore |
OLD | NEW |