internal/stroke: optimize arc drawing

Arc with a small angle doesn't need many segments.

Updates: https://todo.sr.ht/~eliasnaur/gio/313
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
Egon Elbre
2022-03-12 14:11:56 +02:00
committed by Elias Naur
parent 99f6224eb7
commit 3fd231367f
6 changed files with 16 additions and 7 deletions
+1 -3
View File
@@ -286,9 +286,7 @@ func (p *Path) QuadTo(ctrl, to f32.Point) {
// The sign of angle determines the direction; positive being counter-clockwise,
// negative clockwise.
func (p *Path) ArcTo(f1, f2 f32.Point, angle float32) {
const segments = 16
m := stroke.ArcTransform(p.pen, f1, f2, angle, segments)
m, segments := stroke.ArcTransform(p.pen, f1, f2, angle)
for i := 0; i < segments; i++ {
p0 := p.pen
p1 := m.Transform(p0)