bugfix, make sure they actually span
This commit is contained in:
parent
0abafbca6f
commit
01254d2398
1 changed files with 10 additions and 8 deletions
|
@ -1127,6 +1127,9 @@ proc solveX(entry: PartitionEntry, y: float32): float32 {.inline.} =
|
||||||
proc solveY(entry: PartitionEntry, x: float32): float32 {.inline.} =
|
proc solveY(entry: PartitionEntry, x: float32): float32 {.inline.} =
|
||||||
entry.m * x + entry.b
|
entry.m * x + entry.b
|
||||||
|
|
||||||
|
proc midpointX(segment: Segment): float32 {.inline.} =
|
||||||
|
(segment.at.x + segment.to.x) * 0.5
|
||||||
|
|
||||||
proc requiresAntiAliasing(segment: Segment): bool {.inline.} =
|
proc requiresAntiAliasing(segment: Segment): bool {.inline.} =
|
||||||
## Returns true if the segment requires antialiasing.
|
## Returns true if the segment requires antialiasing.
|
||||||
|
|
||||||
|
@ -1234,11 +1237,13 @@ proc partitionSegments(
|
||||||
entry1 = partition.entries[1].segment
|
entry1 = partition.entries[1].segment
|
||||||
var at: Vec2
|
var at: Vec2
|
||||||
if not intersectsInside(entry0, entry1, at):
|
if not intersectsInside(entry0, entry1, at):
|
||||||
# These two segments do not intersect, enable shortcut
|
if entry0.at.y <= top and entry0.to.y >= bottom and
|
||||||
partition.twoNonintersectingSpanningSegments = true
|
entry1.at.y <= top and entry1.to.y >= bottom:
|
||||||
# Ensure entry[0] is on the left
|
# These two segments do not intersect and span the partition
|
||||||
if entry1.at.x < entry0.at.x:
|
partition.twoNonintersectingSpanningSegments = true
|
||||||
swap partition.entries[1], partition.entries[0]
|
# Ensure entry[0] is on the left
|
||||||
|
if entry0.midpointX > entry1.midpointX:
|
||||||
|
swap partition.entries[1], partition.entries[0]
|
||||||
|
|
||||||
proc maxEntryCount(partitions: var seq[Partition]): int =
|
proc maxEntryCount(partitions: var seq[Partition]): int =
|
||||||
for i in 0 ..< partitions.len:
|
for i in 0 ..< partitions.len:
|
||||||
|
@ -1962,9 +1967,6 @@ proc fillShapes(
|
||||||
|
|
||||||
var noEntriesInScanlineOverlap = true
|
var noEntriesInScanlineOverlap = true
|
||||||
|
|
||||||
proc midpointX(segment: Segment): float32 {.inline.} =
|
|
||||||
(segment.at.x + segment.to.x) * 0.5
|
|
||||||
|
|
||||||
for i in 1 ..< numEntryIndices:
|
for i in 1 ..< numEntryIndices:
|
||||||
var
|
var
|
||||||
j = i - 1
|
j = i - 1
|
||||||
|
|
Loading…
Reference in a new issue