0.0.14
This commit is contained in:
parent
e9d340d6a4
commit
52eb2d2037
|
@ -1,4 +1,4 @@
|
||||||
version = "0.0.13"
|
version = "0.0.14"
|
||||||
author = "Andre von Houck and Ryan Oldenburg"
|
author = "Andre von Houck and Ryan Oldenburg"
|
||||||
description = "Full-featured 2d graphics library for Nim."
|
description = "Full-featured 2d graphics library for Nim."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -82,7 +82,7 @@ proc fill*(image: Image, rgba: ColorRgba) =
|
||||||
# When supported, SIMD fill until we run out of room.
|
# When supported, SIMD fill until we run out of room.
|
||||||
let m = mm_set1_epi32(cast[int32](rgba))
|
let m = mm_set1_epi32(cast[int32](rgba))
|
||||||
while i < image.data.len - 4:
|
while i < image.data.len - 4:
|
||||||
mm_store_si128(image.data[i].addr, m)
|
mm_storeu_si128(image.data[i].addr, m)
|
||||||
i += 4
|
i += 4
|
||||||
else:
|
else:
|
||||||
when sizeof(int) == 8:
|
when sizeof(int) == 8:
|
||||||
|
@ -99,12 +99,13 @@ proc fill*(image: Image, rgba: ColorRgba) =
|
||||||
|
|
||||||
proc invert*(image: Image) =
|
proc invert*(image: Image) =
|
||||||
## Inverts all of the colors and alpha.
|
## Inverts all of the colors and alpha.
|
||||||
let vec255 = mm_set1_epi8(255)
|
|
||||||
var i: int
|
var i: int
|
||||||
|
when defined(amd64):
|
||||||
|
let vec255 = mm_set1_epi8(255)
|
||||||
while i < image.data.len - 4:
|
while i < image.data.len - 4:
|
||||||
var m = mm_loadu_si128(image.data[i].addr)
|
var m = mm_loadu_si128(image.data[i].addr)
|
||||||
m = mm_sub_epi8(vec255, m)
|
m = mm_sub_epi8(vec255, m)
|
||||||
mm_store_si128(image.data[i].addr, m)
|
mm_storeu_si128(image.data[i].addr, m)
|
||||||
i += 4
|
i += 4
|
||||||
for j in i ..< image.data.len:
|
for j in i ..< image.data.len:
|
||||||
var rgba = image.data[j]
|
var rgba = image.data[j]
|
||||||
|
|
Loading…
Reference in a new issue