f
This commit is contained in:
parent
e5d8589c4a
commit
c7dd442a30
1 changed files with 7 additions and 10 deletions
|
@ -1143,7 +1143,7 @@ proc partitionSegments(
|
||||||
partition.requiresAntiAliasing =
|
partition.requiresAntiAliasing =
|
||||||
requiresAntiAliasing(partition.entries)
|
requiresAntiAliasing(partition.entries)
|
||||||
|
|
||||||
proc getIndexForY(partitioning: Partitioning, y: int): uint32 {.inline.} =
|
proc getIndexForY(partitioning: var Partitioning, y: int): uint32 {.inline.} =
|
||||||
if partitioning.partitions.len == 1:
|
if partitioning.partitions.len == 1:
|
||||||
0.uint32
|
0.uint32
|
||||||
else:
|
else:
|
||||||
|
@ -1152,7 +1152,7 @@ proc getIndexForY(partitioning: Partitioning, y: int): uint32 {.inline.} =
|
||||||
partitioning.partitions.high.uint32
|
partitioning.partitions.high.uint32
|
||||||
)
|
)
|
||||||
|
|
||||||
proc maxEntryCount(partitioning: Partitioning): int =
|
proc maxEntryCount(partitioning: var Partitioning): int =
|
||||||
for i in 0 ..< partitioning.partitions.len:
|
for i in 0 ..< partitioning.partitions.len:
|
||||||
result = max(result, partitioning.partitions[i].entries.len)
|
result = max(result, partitioning.partitions[i].entries.len)
|
||||||
|
|
||||||
|
@ -1240,12 +1240,10 @@ proc computeCoverage(
|
||||||
aa: var bool,
|
aa: var bool,
|
||||||
width: float32,
|
width: float32,
|
||||||
y, startX: int,
|
y, startX: int,
|
||||||
partitioning: Partitioning,
|
partitioning: var Partitioning,
|
||||||
windingRule: WindingRule
|
windingRule: WindingRule
|
||||||
) {.inline.} =
|
) {.inline.} =
|
||||||
let
|
let partitionIndex = partitioning.getIndexForY(y)
|
||||||
partitionIndex = partitioning.getIndexForY(y)
|
|
||||||
partitionEntryCount = partitioning.partitions[partitionIndex].entries.len
|
|
||||||
|
|
||||||
aa = partitioning.partitions[partitionIndex].requiresAntiAliasing
|
aa = partitioning.partitions[partitionIndex].requiresAntiAliasing
|
||||||
|
|
||||||
|
@ -1259,8 +1257,7 @@ proc computeCoverage(
|
||||||
for m in 0 ..< quality:
|
for m in 0 ..< quality:
|
||||||
yLine += offset
|
yLine += offset
|
||||||
numHits = 0
|
numHits = 0
|
||||||
for i in 0 ..< partitionEntryCount: # Perf
|
for entry in partitioning.partitions[partitionIndex].entries.mitems:
|
||||||
let entry = partitioning.partitions[partitionIndex].entries[i].unsafeAddr # Perf
|
|
||||||
if entry.segment.at.y <= yLine and entry.segment.to.y >= yLine:
|
if entry.segment.at.y <= yLine and entry.segment.to.y >= yLine:
|
||||||
let x =
|
let x =
|
||||||
if entry.m == 0:
|
if entry.m == 0:
|
||||||
|
@ -1620,7 +1617,6 @@ proc fillShapes(
|
||||||
else:
|
else:
|
||||||
0
|
0
|
||||||
pathHeight = min(image.height, (bounds.y + bounds.h).int)
|
pathHeight = min(image.height, (bounds.y + bounds.h).int)
|
||||||
partitioning = partitionSegments(segments, startY, pathHeight - startY)
|
|
||||||
|
|
||||||
if pathWidth == 0:
|
if pathWidth == 0:
|
||||||
return
|
return
|
||||||
|
@ -1629,6 +1625,7 @@ proc fillShapes(
|
||||||
raise newException(PixieError, "Path int overflow detected")
|
raise newException(PixieError, "Path int overflow detected")
|
||||||
|
|
||||||
var
|
var
|
||||||
|
partitioning = partitionSegments(segments, startY, pathHeight - startY)
|
||||||
coverages = newSeq[uint8](pathWidth)
|
coverages = newSeq[uint8](pathWidth)
|
||||||
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)
|
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)
|
||||||
numHits: int
|
numHits: int
|
||||||
|
@ -1689,7 +1686,6 @@ proc fillShapes(
|
||||||
else:
|
else:
|
||||||
0
|
0
|
||||||
pathHeight = min(mask.height, (bounds.y + bounds.h).int)
|
pathHeight = min(mask.height, (bounds.y + bounds.h).int)
|
||||||
partitioning = partitionSegments(segments, startY, pathHeight)
|
|
||||||
|
|
||||||
if pathWidth == 0:
|
if pathWidth == 0:
|
||||||
return
|
return
|
||||||
|
@ -1698,6 +1694,7 @@ proc fillShapes(
|
||||||
raise newException(PixieError, "Path int overflow detected")
|
raise newException(PixieError, "Path int overflow detected")
|
||||||
|
|
||||||
var
|
var
|
||||||
|
partitioning = partitionSegments(segments, startY, pathHeight)
|
||||||
coverages = newSeq[uint8](pathWidth)
|
coverages = newSeq[uint8](pathWidth)
|
||||||
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)
|
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)
|
||||||
numHits: int
|
numHits: int
|
||||||
|
|
Loading…
Reference in a new issue