typo, better benchmark

This commit is contained in:
Ryan Oldenburg 2021-10-12 13:10:50 -05:00
parent 834cdaa23a
commit db378d2a8f
2 changed files with 17 additions and 6 deletions

View file

@ -540,7 +540,7 @@ proc getRgbaSmooth*(
image: Image, x, y: float32, wrapped = false
): ColorRGBX {.raises: [].} =
## Gets a interpolated color with float point coordinates.
## Pixes outside the image are transparent.
## Pixels outside the image are transparent.
let
x0 = x.floor.int
y0 = y.floor.int

View file

@ -1,4 +1,4 @@
import benchy, chroma, pixie, vmath
import benchy, chroma, pixie, random, vmath
block:
let
@ -49,7 +49,7 @@ block:
a = newImage(1000, 1000)
b = newImage(500, 500)
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
b.fill(rgba(0, rand(255).uint8, 0, 255))
timeIt "draw Smooth [x translate]":
a.draw(b, translate(vec2(25.2, 0)), bmNormal)
@ -60,7 +60,7 @@ block:
a = newImage(1000, 1000)
b = newImage(500, 500)
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
b.fill(rgba(0, rand(255).uint8, 0, 255))
timeIt "draw Smooth [y translate]":
a.draw(b, translate(vec2(0, 25.2)), bmNormal)
@ -71,7 +71,7 @@ block:
a = newImage(1000, 1000)
b = newImage(500, 500)
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
b.fill(rgba(0, rand(255).uint8, 0, 255))
timeIt "draw Smooth [x + y translate]":
a.draw(b, translate(vec2(25.2, 25.2)), bmNormal)
@ -82,12 +82,23 @@ block:
a = newImage(1000, 1000)
b = newImage(500, 500)
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
b.fill(rgba(0, rand(255).uint8, 0, 255))
timeIt "draw Smooth [rotate 45 deg]":
a.draw(b, translate(vec2(0, 500)) * rotate(toRadians(45)), bmNormal)
keep(b)
block:
let
a = newImage(1000, 1000)
b = newMask(500, 500)
a.fill(rgba(255, 0, 0, 255))
b.fill(rand(255).uint8)
timeIt "draw mask Smooth [rotate 45 deg]":
a.draw(b, translate(vec2(0, 500)) * rotate(toRadians(45)), bmNormal)
keep(b)
block:
let
a = newImage(100, 100)