check bounds when aligning
This commit is contained in:
parent
17cfb62ab3
commit
e107f85fb0
|
@ -1448,9 +1448,7 @@ proc blendLineCoverageNormal(
|
|||
) {.hasSimd.} =
|
||||
for i in 0 ..< len:
|
||||
let coverage = coverages[i]
|
||||
if coverage == 255 and rgbx.a == 255:
|
||||
line[i] = rgbx
|
||||
elif coverage == 0:
|
||||
if coverage == 0:
|
||||
discard
|
||||
else:
|
||||
line[i] = blendNormal(line[i], rgbx * coverage)
|
||||
|
@ -1463,9 +1461,7 @@ proc blendLineCoverageMask(
|
|||
) {.hasSimd.} =
|
||||
for i in 0 ..< len:
|
||||
let coverage = coverages[i]
|
||||
if coverage == 0:
|
||||
line[i] = rgbx(0, 0, 0, 0)
|
||||
elif coverage == 255:
|
||||
if coverage == 255:
|
||||
discard
|
||||
else:
|
||||
line[i] = blendMask(line[i], rgbx * coverage)
|
||||
|
|
|
@ -419,7 +419,7 @@ proc blendLineNormalAvx2*(
|
|||
line: ptr UncheckedArray[ColorRGBX], rgbx: ColorRGBX, len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 31) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 31) != 0:
|
||||
line[i] = blendNormal(line[i], rgbx)
|
||||
inc i
|
||||
|
||||
|
@ -445,7 +445,7 @@ proc blendLineNormalAvx2*(
|
|||
a, b: ptr UncheckedArray[ColorRGBX], len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](a[i].addr) and 31) != 0:
|
||||
while i < len and (cast[uint](a[i].addr) and 31) != 0:
|
||||
a[i] = blendNormal(a[i], b[i])
|
||||
inc i
|
||||
|
||||
|
@ -477,7 +477,7 @@ proc blendLineMaskAvx2*(
|
|||
line: ptr UncheckedArray[ColorRGBX], rgbx: ColorRGBX, len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 31) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 31) != 0:
|
||||
line[i] = blendMask(line[i], rgbx)
|
||||
inc i
|
||||
|
||||
|
@ -502,7 +502,7 @@ proc blendLineMaskAvx2*(
|
|||
a, b: ptr UncheckedArray[ColorRGBX], len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](a[i].addr) and 31) != 0:
|
||||
while i < len and (cast[uint](a[i].addr) and 31) != 0:
|
||||
a[i] = blendMask(a[i], b[i])
|
||||
inc i
|
||||
|
||||
|
|
|
@ -538,7 +538,7 @@ proc blendLineCoverageOverwriteSse2*(
|
|||
len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 15) != 0:
|
||||
let coverage = coverages[i]
|
||||
if coverage != 0:
|
||||
line[i] = rgbx * coverage
|
||||
|
@ -575,7 +575,7 @@ proc blendLineNormalSse2*(
|
|||
line: ptr UncheckedArray[ColorRGBX], rgbx: ColorRGBX, len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 15) != 0:
|
||||
line[i] = blendNormal(line[i], rgbx)
|
||||
inc i
|
||||
|
||||
|
@ -597,7 +597,7 @@ proc blendLineNormalSse2*(
|
|||
a, b: ptr UncheckedArray[ColorRGBX], len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](a[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](a[i].addr) and 15) != 0:
|
||||
a[i] = blendNormal(a[i], b[i])
|
||||
inc i
|
||||
|
||||
|
@ -628,11 +628,9 @@ proc blendLineCoverageNormalSse2*(
|
|||
len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 15) != 0:
|
||||
let coverage = coverages[i]
|
||||
if coverage == 255 and rgbx.a == 255:
|
||||
line[i] = rgbx
|
||||
elif coverage == 0:
|
||||
if coverage == 0:
|
||||
discard
|
||||
else:
|
||||
line[i] = blendNormal(line[i], rgbx * coverage)
|
||||
|
@ -669,9 +667,7 @@ proc blendLineCoverageNormalSse2*(
|
|||
|
||||
for i in i ..< len:
|
||||
let coverage = coverages[i]
|
||||
if coverage == 255 and rgbx.a == 255:
|
||||
line[i] = rgbx
|
||||
elif coverage == 0:
|
||||
if coverage == 0:
|
||||
discard
|
||||
else:
|
||||
line[i] = blendNormal(line[i], rgbx * coverage)
|
||||
|
@ -680,7 +676,7 @@ proc blendLineMaskSse2*(
|
|||
line: ptr UncheckedArray[ColorRGBX], rgbx: ColorRGBX, len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 15) != 0:
|
||||
line[i] = blendMask(line[i], rgbx)
|
||||
inc i
|
||||
|
||||
|
@ -701,7 +697,7 @@ proc blendLineMaskSse2*(
|
|||
a, b: ptr UncheckedArray[ColorRGBX], len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](a[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](a[i].addr) and 15) != 0:
|
||||
a[i] = blendMask(a[i], b[i])
|
||||
inc i
|
||||
|
||||
|
@ -731,7 +727,7 @@ proc blendLineCoverageMaskSse2*(
|
|||
len: int
|
||||
) {.simd.} =
|
||||
var i: int
|
||||
while (cast[uint](line[i].addr) and 15) != 0:
|
||||
while i < len and (cast[uint](line[i].addr) and 15) != 0:
|
||||
let coverage = coverages[i]
|
||||
if coverage == 0:
|
||||
line[i] = rgbx(0, 0, 0, 0)
|
||||
|
|
Loading…
Reference in a new issue