This commit is contained in:
Ryan Oldenburg 2022-07-07 21:40:02 -05:00
parent 0b8d8029f3
commit 316bf1ce4f

View file

@ -71,12 +71,7 @@ proc fillUnsafe*(
) {.hasSimd, raises: [].} =
## Fills the image data with the color starting at index start and
## continuing for len indices.
when allowSimd and compiles(fillUnsafeSimd):
fillUnsafeSimd(data, start, len, color)
return
let rgbx = color.asRgbx()
# Use memset when every byte has the same value
if rgbx.r == rgbx.g and rgbx.r == rgbx.b and rgbx.r == rgbx.a:
nimSetMem(data[start].addr, rgbx.r.cint, len * 4)