small stuff
This commit is contained in:
parent
4e5b2cd91e
commit
9e132b6457
3 changed files with 20 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
import benchy, cairo, chroma, math, pixie
|
import benchy, cairo, chroma, math, pixie
|
||||||
|
|
||||||
block:
|
block:
|
||||||
var
|
let
|
||||||
surface = imageSurfaceCreate(FORMAT_ARGB32, 1920, 1080)
|
surface = imageSurfaceCreate(FORMAT_ARGB32, 1920, 1080)
|
||||||
ctx = surface.create()
|
ctx = surface.create()
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ block:
|
||||||
|
|
||||||
# discard surface.writeToPng("cairo1.png")
|
# discard surface.writeToPng("cairo1.png")
|
||||||
|
|
||||||
var a = newImage(1920, 1080)
|
let a = newImage(1920, 1080)
|
||||||
a.fill(rgba(255, 255, 255, 255))
|
a.fill(rgba(255, 255, 255, 255))
|
||||||
|
|
||||||
timeIt "pixie1":
|
timeIt "pixie1":
|
||||||
|
@ -34,7 +34,7 @@ block:
|
||||||
# a.writeFile("pixie1.png")
|
# a.writeFile("pixie1.png")
|
||||||
|
|
||||||
block:
|
block:
|
||||||
var
|
let
|
||||||
surface = imageSurfaceCreate(FORMAT_ARGB32, 1920, 1080)
|
surface = imageSurfaceCreate(FORMAT_ARGB32, 1920, 1080)
|
||||||
ctx = surface.create()
|
ctx = surface.create()
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ block:
|
||||||
|
|
||||||
# discard surface.writeToPng("cairo2.png")
|
# discard surface.writeToPng("cairo2.png")
|
||||||
|
|
||||||
var a = newImage(1920, 1080)
|
let a = newImage(1920, 1080)
|
||||||
a.fill(rgba(255, 255, 255, 255))
|
a.fill(rgba(255, 255, 255, 255))
|
||||||
|
|
||||||
timeIt "pixie2":
|
timeIt "pixie2":
|
||||||
|
|
|
@ -709,7 +709,7 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) =
|
||||||
else:
|
else:
|
||||||
var x = xMin
|
var x = xMin
|
||||||
when defined(amd64) and not defined(pixieNoSimd):
|
when defined(amd64) and not defined(pixieNoSimd):
|
||||||
if dx.x == 1 and dx.y == 0 and dy.x == 0 and dy.y == 1:
|
if dx == vec2(1, 0) and dy == vec2(0, 1):
|
||||||
# Check we are not rotated before using SIMD blends
|
# Check we are not rotated before using SIMD blends
|
||||||
when type(a) is Image:
|
when type(a) is Image:
|
||||||
if blendMode.hasSimdBlender():
|
if blendMode.hasSimdBlender():
|
||||||
|
@ -732,7 +732,6 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) =
|
||||||
blenderSimd(backdrop, source)
|
blenderSimd(backdrop, source)
|
||||||
)
|
)
|
||||||
x += 4
|
x += 4
|
||||||
|
|
||||||
else: # is a Mask
|
else: # is a Mask
|
||||||
if blendMode.hasSimdMasker():
|
if blendMode.hasSimdMasker():
|
||||||
let maskerSimd = blendMode.maskerSimd()
|
let maskerSimd = blendMode.maskerSimd()
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import benchy, nimPNG, pixie/fileformats/png, stb_image/read as stbi,
|
import benchy, cairo, nimPNG, pixie/fileformats/png, stb_image/read as stbi,
|
||||||
stb_image/write as stbr
|
stb_image/write as stbr
|
||||||
|
|
||||||
let data = readFile("tests/images/png/lenna.png")
|
let
|
||||||
|
filePath = "tests/images/png/lenna.png"
|
||||||
|
data = readFile(filePath)
|
||||||
|
|
||||||
timeIt "pixie decode":
|
timeIt "pixie decode":
|
||||||
keep decodePng(cast[seq[uint8]](data))
|
keep decodePng(cast[seq[uint8]](data))
|
||||||
|
@ -37,3 +39,14 @@ timeIt "stb_image encode":
|
||||||
stbi.RGBA
|
stbi.RGBA
|
||||||
)
|
)
|
||||||
keep writePNG(width, height, channels, decoded).len
|
keep writePNG(width, height, channels, decoded).len
|
||||||
|
|
||||||
|
timeIt "cairo decode":
|
||||||
|
keep imageSurfaceCreateFromPng(filePath)
|
||||||
|
|
||||||
|
timeIt "cairo encode":
|
||||||
|
let decoded = imageSurfaceCreateFromPng(filePath)
|
||||||
|
|
||||||
|
var write: WriteFunc = proc(closure: pointer, data: cstring, len: int32): Status {.cdecl.} =
|
||||||
|
StatusSuccess
|
||||||
|
|
||||||
|
discard decoded.writeToPng(write, nil)
|
||||||
|
|
Loading…
Reference in a new issue