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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 static FloatShapeInterval clippedCircleXRange(const FloatPoint& center, | 102 static FloatShapeInterval clippedCircleXRange(const FloatPoint& center, |
103 float radius, | 103 float radius, |
104 float y1, | 104 float y1, |
105 float y2) { | 105 float y2) { |
106 if (y1 >= center.y() + radius || y2 <= center.y() - radius) | 106 if (y1 >= center.y() + radius || y2 <= center.y() - radius) |
107 return FloatShapeInterval(); | 107 return FloatShapeInterval(); |
108 | 108 |
109 if (center.y() >= y1 && center.y() <= y2) | 109 if (center.y() >= y1 && center.y() <= y2) |
110 return FloatShapeInterval(center.x() - radius, center.x() + radius); | 110 return FloatShapeInterval(center.x() - radius, center.x() + radius); |
111 | 111 |
112 // Clip the circle to the vertical range y1,y2 and return the extent of the cl
ipped circle's | 112 // Clip the circle to the vertical range y1,y2 and return the extent of the |
113 // projection on the X axis | 113 // clipped circle's projection on the X axis |
114 | 114 |
115 float xi = circleXIntercept((y2 < center.y() ? y2 : y1) - center.y(), radius); | 115 float xi = circleXIntercept((y2 < center.y() ? y2 : y1) - center.y(), radius); |
116 return FloatShapeInterval(center.x() - xi, center.x() + xi); | 116 return FloatShapeInterval(center.x() - xi, center.x() + xi); |
117 } | 117 } |
118 | 118 |
119 LayoutRect PolygonShape::shapeMarginLogicalBoundingBox() const { | 119 LayoutRect PolygonShape::shapeMarginLogicalBoundingBox() const { |
120 FloatRect box = m_polygon.boundingBox(); | 120 FloatRect box = m_polygon.boundingBox(); |
121 box.inflate(shapeMargin()); | 121 box.inflate(shapeMargin()); |
122 return LayoutRect(box); | 122 return LayoutRect(box); |
123 } | 123 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void PolygonShape::buildDisplayPaths(DisplayPaths& paths) const { | 168 void PolygonShape::buildDisplayPaths(DisplayPaths& paths) const { |
169 if (!m_polygon.numberOfVertices()) | 169 if (!m_polygon.numberOfVertices()) |
170 return; | 170 return; |
171 paths.shape.moveTo(m_polygon.vertexAt(0)); | 171 paths.shape.moveTo(m_polygon.vertexAt(0)); |
172 for (size_t i = 1; i < m_polygon.numberOfVertices(); ++i) | 172 for (size_t i = 1; i < m_polygon.numberOfVertices(); ++i) |
173 paths.shape.addLineTo(m_polygon.vertexAt(i)); | 173 paths.shape.addLineTo(m_polygon.vertexAt(i)); |
174 paths.shape.closeSubpath(); | 174 paths.shape.closeSubpath(); |
175 } | 175 } |
176 | 176 |
177 } // namespace blink | 177 } // namespace blink |
OLD | NEW |