simple pure-internal fix for a test

This commit is contained in:
Ryan Oldenburg 2023-01-14 22:52:57 -06:00
parent 49ae1253ce
commit 94962eb163
2 changed files with 13 additions and 10 deletions

View file

@ -1056,7 +1056,10 @@ proc commandsToShapes(
shape.addSegment(at, start)
result.add(shape)
proc shapesToSegments(shapes: seq[Polygon]): seq[(Segment, int16)] =
proc shapesToSegments(
shapes: seq[Polygon],
skipHorizontal = true
): seq[(Segment, int16)] =
## Converts the shapes into a set of filtered segments with winding value.
# Quantize the segment to prevent leaks
@ -1075,7 +1078,7 @@ proc shapesToSegments(shapes: seq[Polygon]): seq[(Segment, int16)] =
segment = segment(vec1, vec2)
vec1 = vec2
if segment.at.y == segment.to.y: # Skip horizontal
if skipHorizontal and segment.at.y == segment.to.y: # Skip horizontal
continue
var
segment = segment
@ -1119,7 +1122,7 @@ proc computeBounds*(
## Compute the bounds of the path.
var shapes = path.commandsToShapes(true, pixelScale(transform))
shapes.transform(transform)
computeBounds(shapes.shapesToSegments())
computeBounds(shapes.shapesToSegments(skipHorizontal = false))
proc initPartitionEntry(segment: Segment, winding: int16): PartitionEntry =
result.segment = segment

View file

@ -746,13 +746,13 @@ block:
# let path = parsePath(pathStr)
# doAssert path.computeBounds() == rect(0, 0, 1000, 1000)
# block:
# let pathStr = """
# M 0 0
# L 100 0
# """
# let path = parsePath(pathStr)
# doAssert path.computeBounds() == rect(0, 0, 100, 0)
block:
let pathStr = """
M 0 0
L 100 0
"""
let path = parsePath(pathStr)
doAssert path.computeBounds() == rect(0, 0, 100, 0)
block:
let pathStr = """