morepretty

This commit is contained in:
Ryan Oldenburg 2022-06-26 21:58:50 -05:00
parent 3a289a6172
commit ce062a5949
2 changed files with 8 additions and 4 deletions

View file

@ -203,8 +203,8 @@ proc isOpaque*(data: var seq[ColorRGBX], start, len: int): bool =
when defined(amd64) and allowSimd: when defined(amd64) and allowSimd:
proc applyOpacity*(color: M128, opacity: float32): ColorRGBX {.inline.} = proc applyOpacity*(color: M128, opacity: float32): ColorRGBX {.inline.} =
let opacityVec = mm_set1_ps(opacity) let opacityVec = mm_set1_ps(opacity)
var finalColor = mm_cvtps_epi32(mm_mul_ps(color, opacityVec)) var finalColor = mm_cvtps_epi32(mm_mul_ps(color, opacityVec))
finalColor = mm_packus_epi16(finalColor, mm_setzero_si128()) finalColor = mm_packus_epi16(finalColor, mm_setzero_si128())
finalColor = mm_packus_epi16(finalColor, mm_setzero_si128()) finalColor = mm_packus_epi16(finalColor, mm_setzero_si128())
cast[ColorRGBX](mm_cvtsi128_si32(finalColor)) cast[ColorRGBX](mm_cvtsi128_si32(finalColor))

View file

@ -1171,7 +1171,9 @@ proc partitionSegments(
var entryCounts = newSeq[int](numPartitions) var entryCounts = newSeq[int](numPartitions)
for (segment, _) in segments: for (segment, _) in segments:
for partitionIndex in segment.partitionRange(numPartitions, startY, partitionHeight): for partitionIndex in segment.partitionRange(
numPartitions, startY, partitionHeight
):
inc entryCounts[partitionIndex] inc entryCounts[partitionIndex]
for partitionIndex, entryCounts in entryCounts: for partitionIndex, entryCounts in entryCounts:
@ -1179,7 +1181,9 @@ proc partitionSegments(
var indexes = newSeq[int](numPartitions) var indexes = newSeq[int](numPartitions)
for i, (segment, winding) in segments: for i, (segment, winding) in segments:
for partitionIndex in segment.partitionRange(numPartitions, startY, partitionHeight): for partitionIndex in segment.partitionRange(
numPartitions, startY, partitionHeight
):
result[partitionIndex].entries[indexes[partitionIndex]] = entries[i] result[partitionIndex].entries[indexes[partitionIndex]] = entries[i]
inc indexes[partitionIndex] inc indexes[partitionIndex]