pixie/tests/benchmark_paints.nim

44 lines
1.1 KiB
Nim
Raw Normal View History

2021-11-23 10:14:03 +00:00
import benchy, pixie
let image = newImage(1000, 1000)
timeIt "GradientLinear vertical":
2022-02-14 04:02:37 +00:00
let paint = newPaint(LinearGradientPaint)
2021-11-23 10:14:03 +00:00
paint.gradientHandlePositions = @[
vec2(50, 0),
vec2(50, 1000),
]
paint.gradientStops = @[
ColorStop(color: color(1, 0, 0, 1), position: 0),
ColorStop(color: color(1, 0, 0, 0.15625), position: 1.0),
]
image.fillGradient(paint)
timeIt "GradientLinear horizontal":
2022-02-14 04:02:37 +00:00
let paint = newPaint(LinearGradientPaint)
2021-11-23 10:14:03 +00:00
paint.gradientHandlePositions = @[
vec2(0, 50),
vec2(1000, 50),
]
paint.gradientStops = @[
ColorStop(color: color(1, 0, 0, 1), position: 0),
ColorStop(color: color(1, 0, 0, 0.15625), position: 1.0),
]
image.fillGradient(paint)
2021-11-23 10:38:37 +00:00
# timeIt "GradientLinear radial":
# discard
timeIt "GradientLinear angular":
2022-02-14 04:02:37 +00:00
let paint = newPaint(AngularGradientPaint)
2021-11-23 10:38:37 +00:00
paint.gradientHandlePositions = @[
vec2(500, 500),
vec2(1000, 500),
vec2(500, 1000)
]
paint.gradientStops = @[
ColorStop(color: color(1, 0, 0, 1), position: 0),
ColorStop(color: color(1, 0, 0, 0.15625), position: 1.0),
]
image.fillGradient(paint)