From e8da814856294994b177e55d32e259df4a3a9f0d Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Tue, 8 Dec 2020 21:51:09 -0600 Subject: [PATCH] no need for setmem --- src/pixie/images.nim | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/pixie/images.nim b/src/pixie/images.nim index bc0e56e..8d66d94 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -70,17 +70,14 @@ proc `[]=`*(image: Image, x, y: int, rgba: ColorRGBA) {.inline.} = proc fill*(image: Image, rgba: ColorRgba) = ## Fills the image with a solid color. - if rgba.r == rgba.g and rgba.r == rgba.b and rgba.r == rgba.a: - nimSetMem(image.data[0].addr, rgba.r.cint, image.data.len * 4) - else: - # SIMD fill until we run out of room. - let m = mm_set1_epi32(cast[int32](rgba)) - var i: int - while i < image.data.len - 4: - mm_store_si128(image.data[i].addr, m) - i += 4 - for j in i ..< image.data.len: - image.data[j] = rgba + # SIMD fill until we run out of room. + let m = mm_set1_epi32(cast[int32](rgba)) + var i: int + while i < image.data.len - 4: + mm_store_si128(image.data[i].addr, m) + i += 4 + for j in i ..< image.data.len: + image.data[j] = rgba proc invert*(image: Image) = ## Inverts all of the colors and alpha.