pixie/tests/benchmark_masks.nim

64 lines
866 B
Nim
Raw Normal View History

2021-02-14 18:27:32 +00:00
import benchy, chroma, pixie
2021-02-08 22:34:05 +00:00
let mask = newMask(2560, 1440)
proc reset() =
mask.fill(63)
reset()
timeIt "minifyBy2":
let minified = mask.minifyBy2()
doAssert minified[0, 0] == 63
reset()
2021-02-09 04:26:51 +00:00
timeIt "invert":
mask.invert()
reset()
timeIt "applyOpacity":
mask.applyOpacity(0.5)
2021-02-10 03:13:23 +00:00
reset()
timeIt "blur":
mask.blur(40)
2021-02-11 08:38:27 +00:00
reset()
2021-02-11 19:13:09 +00:00
timeIt "ceil":
mask.ceil()
2021-02-11 21:05:34 +00:00
reset()
2021-06-19 20:06:50 +00:00
block spread_1:
2021-10-03 22:49:21 +00:00
let p = newPath()
2021-06-19 20:06:50 +00:00
p.rect(500, 500, 500, 500)
timeIt "spread_1":
mask.fill(0)
mask.fillPath(p)
mask.spread(10)
block spread_2:
2021-10-03 22:49:21 +00:00
let p = newPath()
2021-06-19 20:06:50 +00:00
p.rect(500, 500, 1000, 1000)
timeIt "spread_2":
mask.fill(0)
mask.fillPath(p)
mask.spread(10)
block spread_3:
timeIt "spread_3":
mask.fill(255)
mask.spread(10)
block spread_4:
timeIt "spread_4":
mask.fill(0)
mask.setValueUnsafe(1000, 1000, 255)
mask.spread(10)