From 9f8f8af49276f3fa3fe7680d08854136c40f23c9 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Sat, 25 Jun 2022 01:58:04 -0500 Subject: [PATCH] more and better tests --- experiments/benchmark_cairo.nim | 50 ++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/experiments/benchmark_cairo.nim b/experiments/benchmark_cairo.nim index 82da4e9..daaa3fe 100644 --- a/experiments/benchmark_cairo.nim +++ b/experiments/benchmark_cairo.nim @@ -45,7 +45,7 @@ block: # Basic rect block: # Rounded rect let path = newPath() - path.roundedRect(rect(0, 0, 900, 900), 20, 20, 20, 20) + path.roundedRect(rect(0, 0, 900, 900), 100, 100, 100, 100) let shapes = path.commandsToShapes(true, 1) @@ -67,6 +67,54 @@ block: # Rounded rect windingRule: NonZero )])) +block: # Pentagon + let path = newPath() + path.polygon(vec2(450, 450), 400, 5) + + let shapes = path.commandsToShapes(true, 1) + + benchmarks.add(Benchmark( + name: "pentagon opaque", + fills: @[Fill( + shapes: shapes, + transform: mat3(), + paint: opaque, + windingRule: NonZero + )])) + + benchmarks.add(Benchmark( + name: "pentagon not opaque", + fills: @[Fill( + shapes: shapes, + transform: mat3(), + paint: notOpaque, + windingRule: NonZero + )])) + +block: # Circle + let path = newPath() + path.circle(circle(vec2(450, 450), 400)) + + let shapes = path.commandsToShapes(true, 1) + + benchmarks.add(Benchmark( + name: "circle opaque", + fills: @[Fill( + shapes: shapes, + transform: mat3(), + paint: opaque, + windingRule: NonZero + )])) + + benchmarks.add(Benchmark( + name: "circle not opaque", + fills: @[Fill( + shapes: shapes, + transform: mat3(), + paint: notOpaque, + windingRule: NonZero + )])) + block: # Heart let path = parsePath(""" M 100,300