simple pure-internal fix for a test
This commit is contained in:
parent
49ae1253ce
commit
94962eb163
|
@ -1056,7 +1056,10 @@ proc commandsToShapes(
|
||||||
shape.addSegment(at, start)
|
shape.addSegment(at, start)
|
||||||
result.add(shape)
|
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.
|
## Converts the shapes into a set of filtered segments with winding value.
|
||||||
|
|
||||||
# Quantize the segment to prevent leaks
|
# Quantize the segment to prevent leaks
|
||||||
|
@ -1075,7 +1078,7 @@ proc shapesToSegments(shapes: seq[Polygon]): seq[(Segment, int16)] =
|
||||||
segment = segment(vec1, vec2)
|
segment = segment(vec1, vec2)
|
||||||
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
|
continue
|
||||||
var
|
var
|
||||||
segment = segment
|
segment = segment
|
||||||
|
@ -1119,7 +1122,7 @@ proc computeBounds*(
|
||||||
## Compute the bounds of the path.
|
## Compute the bounds of the path.
|
||||||
var shapes = path.commandsToShapes(true, pixelScale(transform))
|
var shapes = path.commandsToShapes(true, pixelScale(transform))
|
||||||
shapes.transform(transform)
|
shapes.transform(transform)
|
||||||
computeBounds(shapes.shapesToSegments())
|
computeBounds(shapes.shapesToSegments(skipHorizontal = false))
|
||||||
|
|
||||||
proc initPartitionEntry(segment: Segment, winding: int16): PartitionEntry =
|
proc initPartitionEntry(segment: Segment, winding: int16): PartitionEntry =
|
||||||
result.segment = segment
|
result.segment = segment
|
||||||
|
|
|
@ -746,13 +746,13 @@ block:
|
||||||
# let path = parsePath(pathStr)
|
# let path = parsePath(pathStr)
|
||||||
# doAssert path.computeBounds() == rect(0, 0, 1000, 1000)
|
# doAssert path.computeBounds() == rect(0, 0, 1000, 1000)
|
||||||
|
|
||||||
# block:
|
block:
|
||||||
# let pathStr = """
|
let pathStr = """
|
||||||
# M 0 0
|
M 0 0
|
||||||
# L 100 0
|
L 100 0
|
||||||
# """
|
"""
|
||||||
# let path = parsePath(pathStr)
|
let path = parsePath(pathStr)
|
||||||
# doAssert path.computeBounds() == rect(0, 0, 100, 0)
|
doAssert path.computeBounds() == rect(0, 0, 100, 0)
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let pathStr = """
|
let pathStr = """
|
||||||
|
|
Loading…
Reference in a new issue