tests stuff
This commit is contained in:
parent
29099a08eb
commit
65afc67792
|
@ -44,8 +44,7 @@ proc writeFile*(image: Image, filePath: string) =
|
|||
let fileFormat = case splitFile(filePath).ext:
|
||||
of ".png": ffPng
|
||||
of ".bmp": ffBmp
|
||||
of ".jpg": ffJpg
|
||||
of ".jpeg": ffJpg
|
||||
of ".jpg",".jpeg": ffJpg
|
||||
else:
|
||||
raise newException(PixieError, "Unsupported image file extension")
|
||||
image.writeFile(filePath, fileformat)
|
||||
|
|
|
@ -319,3 +319,17 @@ timeIt "blendExcludeMaskFloats":
|
|||
).rgba
|
||||
|
||||
reset()
|
||||
|
||||
timeIt "blendNormalPremultiplied":
|
||||
for i in 0 ..< backdrop.data.len:
|
||||
backdrop.data[i] = blendNormalPremultiplied(backdrop.data[i], source.data[i])
|
||||
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
import nimsimd/sse2
|
||||
|
||||
timeIt "blendNormalPremultiplied [simd]":
|
||||
for i in countup(0, backdrop.data.len - 4, 4):
|
||||
let
|
||||
b = mm_loadu_si128(backdrop.data[i].addr)
|
||||
s = mm_loadu_si128(source.data[i].addr)
|
||||
mm_storeu_si128(backdrop.data[i].addr, blendNormalPremultiplied(b, s))
|
||||
|
|
|
@ -27,11 +27,11 @@ timeIt "sharpOpacity":
|
|||
|
||||
a.fill(rgba(63, 127, 191, 191))
|
||||
|
||||
timeIt "toAlphy":
|
||||
a.toAlphy()
|
||||
timeIt "toPremultipliedAlpha":
|
||||
a.toPremultipliedAlpha()
|
||||
|
||||
timeIt "fromAlphy":
|
||||
a.fromAlphy()
|
||||
timeIt "toStraightAlpha":
|
||||
a.toStraightAlpha()
|
||||
|
||||
timeIt "lerp integers":
|
||||
for i in 0 ..< 100000:
|
||||
|
|
|
@ -2,7 +2,7 @@ import chroma, pixie/fileformats/png, stb_image/read as stbi, strformat, pngsuit
|
|||
|
||||
for file in pngSuiteFiles:
|
||||
let
|
||||
data = readFile(&"tests/images/pngsuite/{file}.png")
|
||||
data = readFile(&"tests/images/png/pngsuite/{file}.png")
|
||||
pixieLoaded = decodePng(cast[seq[uint8]](data))
|
||||
|
||||
var
|
||||
|
|
Loading…
Reference in a new issue