pixie/tests/bench_masks.nim

72 lines
1.1 KiB
Nim
Raw Normal View History

2022-07-23 05:13:19 +00:00
import benchy, pixie
2021-02-08 22:34:05 +00:00
2022-07-24 03:56:16 +00:00
block:
let mask = newMask(2560, 1440)
2021-02-08 22:34:05 +00:00
2022-07-24 03:56:16 +00:00
proc reset() =
mask.fill(63)
2021-02-09 04:26:51 +00:00
2022-07-23 05:13:19 +00:00
reset()
2021-02-10 03:13:23 +00:00
2022-07-24 03:56:16 +00:00
timeIt "minifyBy2":
let minified = mask.minifyBy2()
doAssert minified[0, 0] == 63
2021-02-10 03:13:23 +00:00
2022-07-24 03:56:16 +00:00
reset()
2021-02-11 08:38:27 +00:00
2022-07-24 03:56:16 +00:00
timeIt "magnifyBy2":
let magnified = mask.magnifyBy2()
doAssert magnified[0, 0] == 63
2021-02-11 08:38:27 +00:00
2022-07-24 03:56:16 +00:00
reset()
2021-02-11 21:05:34 +00:00
2022-07-24 03:56:16 +00:00
timeIt "invert":
mask.invert()
2021-02-11 21:05:34 +00:00
2022-07-24 03:56:16 +00:00
reset()
2021-06-19 20:06:50 +00:00
2022-07-24 03:56:16 +00:00
timeIt "applyOpacity":
reset()
mask.applyOpacity(0.5)
2021-06-19 20:06:50 +00:00
2022-07-24 03:56:16 +00:00
reset()
2021-06-19 20:06:50 +00:00
2022-07-24 03:56:16 +00:00
timeIt "ceil":
mask.ceil()
2021-06-19 20:06:50 +00:00
2022-07-24 03:56:16 +00:00
block:
let mask = newMask(400, 400)
mask.fill(63)
2021-06-19 20:06:50 +00:00
2022-07-24 03:56:16 +00:00
timeIt "blur":
mask.blur(12)
block spread_1:
let p = newPath()
p.rect(100, 100, 200, 200)
timeIt "spread_1":
mask.fill(0)
mask.fillPath(p)
mask.spread(5)
block spread_2:
let p = newPath()
p.rect(100, 100, 200, 200)
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.unsafe[200, 200] = 255
mask.spread(5)