Merge pull request #525 from treeform/guzba

simple pure-internal fix for a test
This commit is contained in:
Andre von Houck 2023-01-14 22:31:02 -08:00 committed by GitHub
commit 6c8d142cbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 11 deletions

View file

@ -11,10 +11,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: ${{ matrix.nim-version }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: nimble test --gc:arc -d:release -y
- run: nimble test --gc:arc -d:release -d:pixieNoSimd -y
- run: nimble test --gc:orc -d:release -y

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 = """