Skip to content

Commit 94962eb

Browse files
committed
simple pure-internal fix for a test
1 parent 49ae125 commit 94962eb

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/pixie/paths.nim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,10 @@ proc commandsToShapes(
10561056
shape.addSegment(at, start)
10571057
result.add(shape)
10581058

1059-
proc shapesToSegments(shapes: seq[Polygon]): seq[(Segment, int16)] =
1059+
proc shapesToSegments(
1060+
shapes: seq[Polygon],
1061+
skipHorizontal = true
1062+
): seq[(Segment, int16)] =
10601063
## Converts the shapes into a set of filtered segments with winding value.
10611064

10621065
# Quantize the segment to prevent leaks
@@ -1075,7 +1078,7 @@ proc shapesToSegments(shapes: seq[Polygon]): seq[(Segment, int16)] =
10751078
segment = segment(vec1, vec2)
10761079
vec1 = vec2
10771080

1078-
if segment.at.y == segment.to.y: # Skip horizontal
1081+
if skipHorizontal and segment.at.y == segment.to.y: # Skip horizontal
10791082
continue
10801083
var
10811084
segment = segment
@@ -1119,7 +1122,7 @@ proc computeBounds*(
11191122
## Compute the bounds of the path.
11201123
var shapes = path.commandsToShapes(true, pixelScale(transform))
11211124
shapes.transform(transform)
1122-
computeBounds(shapes.shapesToSegments())
1125+
computeBounds(shapes.shapesToSegments(skipHorizontal = false))
11231126

11241127
proc initPartitionEntry(segment: Segment, winding: int16): PartitionEntry =
11251128
result.segment = segment

tests/test_paths.nim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,13 +746,13 @@ block:
746746
# let path = parsePath(pathStr)
747747
# doAssert path.computeBounds() == rect(0, 0, 1000, 1000)
748748

749-
# block:
750-
# let pathStr = """
751-
# M 0 0
752-
# L 100 0
753-
# """
754-
# let path = parsePath(pathStr)
755-
# doAssert path.computeBounds() == rect(0, 0, 100, 0)
749+
block:
750+
let pathStr = """
751+
M 0 0
752+
L 100 0
753+
"""
754+
let path = parsePath(pathStr)
755+
doAssert path.computeBounds() == rect(0, 0, 100, 0)
756756

757757
block:
758758
let pathStr = """

0 commit comments

Comments
 (0)