Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 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 "config.h" | 30 #include "config.h" |
| 31 #include "core/rendering/exclusions/ExclusionPolygon.h" | 31 #include "core/rendering/exclusions/ExclusionPolygon.h" |
| 32 | 32 |
| 33 #include "core/platform/graphics/LayoutPoint.h" | 33 #include "core/platform/graphics/LayoutPoint.h" |
| 34 | 34 #include "wtf/MathExtras.h" |
| 35 #include <wtf/MathExtras.h> | |
| 36 | 35 |
| 37 namespace WebCore { | 36 namespace WebCore { |
| 38 | 37 |
| 39 enum EdgeIntersectionType { | 38 enum EdgeIntersectionType { |
| 40 Normal, | 39 Normal, |
| 41 VertexMinY, | 40 VertexMinY, |
| 42 VertexMaxY, | 41 VertexMaxY, |
| 43 VertexYBoth | 42 VertexYBoth |
| 44 }; | 43 }; |
| 45 | 44 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arc Center, float arcRadius, const FloatPoint& startArcVertex, const FloatPoint& end ArcVertex, bool padding) | 112 static inline void appendArc(Vector<FloatPoint>& vertices, const FloatPoint& arc Center, float arcRadius, const FloatPoint& startArcVertex, const FloatPoint& end ArcVertex, bool padding) |
| 114 { | 113 { |
| 115 float startAngle = atan2(startArcVertex.y() - arcCenter.y(), startArcVertex. x() - arcCenter.x()); | 114 float startAngle = atan2(startArcVertex.y() - arcCenter.y(), startArcVertex. x() - arcCenter.x()); |
| 116 float endAngle = atan2(endArcVertex.y() - arcCenter.y(), endArcVertex.x() - arcCenter.x()); | 115 float endAngle = atan2(endArcVertex.y() - arcCenter.y(), endArcVertex.x() - arcCenter.x()); |
| 117 const float twoPI = piFloat * 2; | 116 const float twoPI = piFloat * 2; |
| 118 if (startAngle < 0) | 117 if (startAngle < 0) |
| 119 startAngle += twoPI; | 118 startAngle += twoPI; |
| 120 if (endAngle < 0) | 119 if (endAngle < 0) |
| 121 endAngle += twoPI; | 120 endAngle += twoPI; |
| 122 float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngl e + twoPI - endAngle); | 121 float angle = (startAngle > endAngle) ? (startAngle - endAngle) : (startAngl e + twoPI - endAngle); |
| 123 const float arcSegmentCount = 5; // An odd number so that one arc vertex wil l be eactly arcRadius from arcCenter. | 122 const float arcSegmentCount = 6; // An even number so that one arc vertex wi ll be eactly arcRadius from arcCenter. |
|
leviw_travelin_and_unemployed
2013/05/21 19:32:05
I don't fully understand this change... Where did
| |
| 124 float angle5 = ((padding) ? -angle : twoPI - angle) / arcSegmentCount; | 123 float arcSegmentAngle = ((padding) ? -angle : twoPI - angle) / arcSegmentCo unt; |
| 125 | 124 |
| 126 vertices.append(startArcVertex); | 125 vertices.append(startArcVertex); |
| 127 for (unsigned i = 1; i < arcSegmentCount; ++i) { | 126 for (unsigned i = 1; i < arcSegmentCount; ++i) { |
| 128 float angle = startAngle + angle5 * i; | 127 float angle = startAngle + arcSegmentAngle * i; |
| 129 vertices.append(arcCenter + FloatPoint(cos(angle) * arcRadius, sin(angle ) * arcRadius)); | 128 vertices.append(arcCenter + FloatPoint(cos(angle) * arcRadius, sin(angle ) * arcRadius)); |
| 130 } | 129 } |
| 131 vertices.append(endArcVertex); | 130 vertices.append(endArcVertex); |
| 132 } | 131 } |
| 133 | 132 |
| 134 static inline void snapVerticesToLayoutUnitGrid(Vector<FloatPoint>& vertices) | 133 static inline void snapVerticesToLayoutUnitGrid(Vector<FloatPoint>& vertices) |
| 135 { | 134 { |
| 136 for (unsigned i = 0; i < vertices.size(); ++i) | 135 for (unsigned i = 0; i < vertices.size(); ++i) |
| 137 vertices[i] = flooredLayoutPoint(vertices[i]); | 136 vertices[i] = flooredLayoutPoint(vertices[i]); |
| 138 } | 137 } |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 && polygon.contains(offsetEdgesIntersection) | 499 && polygon.contains(offsetEdgesIntersection) |
| 501 && firstFitRectInPolygon(polygon, potentialFirstFitRect, off setEdges[i].edgeIndex(), offsetEdges[j].edgeIndex())) { | 500 && firstFitRectInPolygon(polygon, potentialFirstFitRect, off setEdges[i].edgeIndex(), offsetEdges[j].edgeIndex())) { |
| 502 firstFitFound = true; | 501 firstFitFound = true; |
| 503 firstFitRect = potentialFirstFitRect; | 502 firstFitRect = potentialFirstFitRect; |
| 504 } | 503 } |
| 505 } | 504 } |
| 506 } | 505 } |
| 507 } | 506 } |
| 508 | 507 |
| 509 if (firstFitFound) | 508 if (firstFitFound) |
| 510 result = LayoutUnit::fromFloatCeil(firstFitRect.y()); | 509 result = ceiledLayoutUnit(firstFitRect.y()); |
|
leviw_travelin_and_unemployed
2013/05/21 19:32:05
Are these different on WebKit then? They're the sa
leviw_travelin_and_unemployed
2013/05/21 22:21:56
Avoid this change
| |
| 511 return firstFitFound; | 510 return firstFitFound; |
| 512 } | 511 } |
| 513 | 512 |
| 514 } // namespace WebCore | 513 } // namespace WebCore |
| OLD | NEW |