summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/ExclusionPolygon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/ExclusionPolygon.cpp')
-rw-r--r--Source/WebCore/rendering/ExclusionPolygon.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/WebCore/rendering/ExclusionPolygon.cpp b/Source/WebCore/rendering/ExclusionPolygon.cpp
index 21beac1ec..efb6acddb 100644
--- a/Source/WebCore/rendering/ExclusionPolygon.cpp
+++ b/Source/WebCore/rendering/ExclusionPolygon.cpp
@@ -190,13 +190,13 @@ static inline bool getVertexIntersectionVertices(const EdgeIntersection& interse
if ((intersection.type == VertexMinY && (thisEdge.vertex1().y() < thisEdge.vertex2().y()))
|| (intersection.type == VertexMaxY && (thisEdge.vertex1().y() > thisEdge.vertex2().y()))) {
- prevVertex = polygon.vertexAt(thisEdge.previousEdge().vertexIndex1);
+ prevVertex = polygon.vertexAt(thisEdge.previousEdge().vertexIndex2);
thisVertex = polygon.vertexAt(thisEdge.vertexIndex1);
nextVertex = polygon.vertexAt(thisEdge.vertexIndex2);
} else {
prevVertex = polygon.vertexAt(thisEdge.vertexIndex1);
thisVertex = polygon.vertexAt(thisEdge.vertexIndex2);
- nextVertex = polygon.vertexAt(thisEdge.nextEdge().vertexIndex2);
+ nextVertex = polygon.vertexAt(thisEdge.nextEdge().vertexIndex1);
}
return true;
@@ -219,7 +219,7 @@ static bool compareEdgeIntersectionX(const EdgeIntersection& intersection1, cons
return (x1 == x2) ? intersection1.type < intersection2.type : x1 < x2;
}
-void ExclusionPolygon::computeXIntersections(float y, bool isMinY, Vector<ExclusionInterval>& result) const
+void ExclusionPolygon::computeXIntersections(float y, Vector<ExclusionInterval>& result) const
{
Vector<ExclusionPolygon::EdgeInterval> overlappingEdges;
m_edgeTree.allOverlaps(ExclusionPolygon::EdgeInterval(y, y, 0), overlappingEdges);
@@ -265,19 +265,19 @@ void ExclusionPolygon::computeXIntersections(float y, bool isMinY, Vector<Exclus
}
if (evenOddCrossing) {
- bool edgeCrossing = thisIntersection.type == Normal;
- if (!edgeCrossing) {
+ bool edgeCrossing = false;
+ if (thisIntersection.type == Normal || !inside || index == intersections.size() - 1)
+ edgeCrossing = true;
+ else {
FloatPoint prevVertex;
FloatPoint thisVertex;
FloatPoint nextVertex;
if (getVertexIntersectionVertices(thisIntersection, prevVertex, thisVertex, nextVertex)) {
- if (nextVertex.y() == y)
- edgeCrossing = (isMinY) ? prevVertex.y() > y : prevVertex.y() < y;
- else if (prevVertex.y() == y)
- edgeCrossing = (isMinY) ? nextVertex.y() > y : nextVertex.y() < y;
+ if (prevVertex.y() == y)
+ edgeCrossing = (thisVertex.x() > prevVertex.x()) ? nextVertex.y() > y : nextVertex.y() < y;
else
- edgeCrossing = true;
+ edgeCrossing = (nextVertex.y() != y);
}
}
if (edgeCrossing)
@@ -331,8 +331,8 @@ void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalHeigh
float y2 = maxYForLogicalLine(logicalTop, logicalHeight);
Vector<ExclusionInterval> y1XIntervals, y2XIntervals;
- computeXIntersections(y1, true, y1XIntervals);
- computeXIntersections(y2, false, y2XIntervals);
+ computeXIntersections(y1, y1XIntervals);
+ computeXIntersections(y2, y2XIntervals);
Vector<ExclusionInterval> mergedIntervals;
mergeExclusionIntervals(y1XIntervals, y2XIntervals, mergedIntervals);
@@ -358,8 +358,8 @@ void ExclusionPolygon::getIncludedIntervals(float logicalTop, float logicalHeigh
float y2 = maxYForLogicalLine(logicalTop, logicalHeight);
Vector<ExclusionInterval> y1XIntervals, y2XIntervals;
- computeXIntersections(y1, true, y1XIntervals);
- computeXIntersections(y2, false, y2XIntervals);
+ computeXIntersections(y1, y1XIntervals);
+ computeXIntersections(y2, y2XIntervals);
Vector<ExclusionInterval> commonIntervals;
intersectExclusionIntervals(y1XIntervals, y2XIntervals, commonIntervals);