Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1244)

Unified Diff: Source/core/rendering/shapes/PolygonShape.cpp

Issue 454123002: Refactor getExcludedIntervals since only one LineSegment is ever returned (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/shapes/PolygonShape.cpp
diff --git a/Source/core/rendering/shapes/PolygonShape.cpp b/Source/core/rendering/shapes/PolygonShape.cpp
index bdd1a948e9fcfa7ba38e26b93aba551e79ccad87..02e239a09e50e1222401fa9db359f1c4ed7fcfee 100644
--- a/Source/core/rendering/shapes/PolygonShape.cpp
+++ b/Source/core/rendering/shapes/PolygonShape.cpp
@@ -120,17 +120,17 @@ LayoutRect PolygonShape::shapeMarginLogicalBoundingBox() const
return LayoutRect(box);
}
-void PolygonShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
+LineSegment PolygonShape::getExcludedInterval(LayoutUnit logicalTop, LayoutUnit logicalHeight) const
{
float y1 = logicalTop.toFloat();
float y2 = logicalTop.toFloat() + logicalHeight.toFloat();
if (m_polygon.isEmpty() || !overlapsYRange(m_polygon.boundingBox(), y1 - shapeMargin(), y2 + shapeMargin()))
- return;
+ return LineSegment();
Vector<const FloatPolygonEdge*> overlappingEdges;
if (!m_polygon.overlappingEdges(y1 - shapeMargin(), y2 + shapeMargin(), overlappingEdges))
- return;
+ return LineSegment();
FloatShapeInterval excludedInterval;
for (unsigned i = 0; i < overlappingEdges.size(); i++) {
@@ -146,8 +146,10 @@ void PolygonShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logica
}
}
- if (!excludedInterval.isEmpty())
- result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2()));
+ if (excludedInterval.isEmpty())
+ return LineSegment();
+
+ return LineSegment(excludedInterval.x1(), excludedInterval.x2());
}
void PolygonShape::buildDisplayPaths(DisplayPaths& paths) const

Powered by Google App Engine
This is Rietveld 408576698